Mediawiki/MultipleInstances
Installing | Multiple Instances | Ubuntu Installation | CentOS7 Installation
Contents |
Overview
If you've followed the previous instructions for a single instance, adding multiple instances of mediawiki should be a snap.
subdomains
setup mysql
login to db
~$ mysql -u root -p
Create next mysql wiki user
~$ mysql> CREATE USER 'wiki2'@'localhost' IDENTIFIED BY 'THISpasswordSHOULDbeCHANGED'; ~$ mysql> exit
login as new user to verify account works
~$ mysql -u wiki2 -p ~$ mysql> exit
create DB
~$ mysql -u root -p ~$ mysql> CREATE DATABASE wikidatabase2;
verify DB creation
~$ mysql> SHOW DATABASES;
assign rights to wiki user for new database created
~$ mysql> GRANT ALL PRIVILEGES ON wikidatabase2.* TO 'wiki2'@'localhost' IDENTIFIED BY 'wikiuserpassword' WITH GRANT OPTION; ~$ mysql> exit
verify permissions have been granted
~$ mysql -u wiki2 -p ~$ mysql> SHOW GRANTS; +---------------------------------------------------------------------------------------------------------------+ | Grants for wiki2@localhost | +---------------------------------------------------------------------------------------------------------------+ | GRANT USAGE ON *.* TO 'wiki2'@'localhost' IDENTIFIED BY PASSWORD '*2K21458K438UYE85A38B9Y7Y78DAEBF4T8689YK4' | | GRANT ALL PRIVILEGES ON `wikidatabase2`.* TO 'wiki2'@'localhost' WITH GRANT OPTION | +---------------------------------------------------------------------------------------------------------------+ 1 row in set (0.00 sec)
create dir/export tar contents
~$ sudo mkdir /var/www/html/sitename2.com ~$ tar -C /var/www/html/sitename2.com -zxf mediawiki-1.22.6.tar.gz
configure apache
go to your httpd.conf file (/etc/httpd/conf/httpd.conf) and uncomment the following line:
NameVirtualHost *:80
If you have sites serving content on 443 (SSL), you'll need to add a second line for listening on that for virtual hosts
NameVirtualHost *:443
Make a new conf file just for this site under /etc/httpd/conf.d/
edit domain2.conf
~$ sudo vi /etc/httpd/conf.d/domain2.conf add: <VirtualHost *:80> ServerName servername2.com ServerAdmin [email protected] DocumentRoot /var/www/html/servername2/mediawiki-1.22.6/ TransferLog logs/servername2-access_log ErrorLog logs/servername2-error_log </VirtualHost>
give folder rights to apache user
~$ sudo chown -R apache:apache /var/www/html/servername2/mediawiki-1.22.6/
verify
~$ ls -la /var/www/html/servername2/ total 12 drwxr-xr-x. 3 root root 4096 Apr 28 14:52 . drwxr-xr-x. 3 root root 4096 Apr 28 15:16 .. drwxr-xr-x. 13 apache apache 4096 Apr 24 17:24 mediawiki-1.22.6
restart apache and finalize install
~$ sudo service httpd restart
Browse to your site's URL
it will let you know no LocalSettings.php file was found and give you a link to begin installation. This install script asks you a bunch of questions and will generate the LocalSettings.php based on your responses.
Save the LocalSettings.php file and copy to your site's directory, which in this case was:
~$ /var/www/html/servername2/mediawiki-1.22.6/
If you opted for Image Uploads, it would have asked for which directory deleted files will go in, by default it is /var/www/html/servername2/mediawiki-1.22.6/images/deleted/, so do the following:
~$ sudo mkdir /var/www/html/servername2/mediawiki-1.22.6/images/deleted/ ~$ sudo chown apache:apache /var/www/html/servername2/mediawiki-1.22.6/images/deleted/
Restart Apache
~$ sudo service httpd restart
Reload the page and your wiki should be operational or at least ready for further configuration.
subsites
subsites make it cheaper for the SSL cert as all sites can be housed under the parent
ie. johnssite.com/wiki
setup mysql
login to db
~$ mysql -u root -p
Create next mysql wiki user
~$ mysql> CREATE USER 'wiki2'@'localhost' IDENTIFIED BY 'THISpasswordSHOULDbeCHANGED'; ~$ mysql> exit
login as new user to verify account works
~$ mysql -u wiki2 -p ~$ mysql> exit
create DB
~$ mysql -u root -p ~$ mysql> CREATE DATABASE wikidatabase2;
verify DB creation
~$ mysql> SHOW DATABASES;
assign rights to wiki user for new database created
~$ mysql> GRANT ALL PRIVILEGES ON wikidatabase2.* TO 'wiki2'@'localhost' IDENTIFIED BY 'wikiuserpassword' WITH GRANT OPTION; ~$ mysql> exit
verify permissions have been granted
~$ mysql -u wiki2 -p ~$ mysql> SHOW GRANTS; +---------------------------------------------------------------------------------------------------------------+ | Grants for wiki2@localhost | +---------------------------------------------------------------------------------------------------------------+ | GRANT USAGE ON *.* TO 'wiki2'@'localhost' IDENTIFIED BY PASSWORD '*2K21458K438UYE85A38B9Y7Y78DAEBF4T8689YK4' | | GRANT ALL PRIVILEGES ON `wikidatabase2`.* TO 'wiki2'@'localhost' WITH GRANT OPTION | +---------------------------------------------------------------------------------------------------------------+ 1 row in set (0.00 sec)
create dir/export tar contents
in your document root, you would create a subfolder and then place the site files there. such as:
~$ sudo mkdir /var/www/html/johnssite.com/wiki ~$ tar -C /var/www/html/johnssite.com/wiki/ -zxf mediawiki-1.22.6.tar.gz
apache
for the virtual host config, it should just point to the main site with no mention of the subsite:
<VirtualHost *:80> ServerName johnssite.com ServerAdmin [email protected] DocumentRoot /var/www/html/johnssite.com TransferLog logs/wiki-access_log ErrorLog logs/wiki-error_log </VirtualHost>
give folder rights to apache user
~$ sudo chown -R apache:apache /var/www/html/johnssite.com/wiki/
verify
~$ ls -la /var/www/html/johnssite.com/ total 12 drwxr-xr-x. 3 root root 4096 Apr 28 14:52 . drwxr-xr-x. 3 root root 4096 Apr 28 15:16 .. drwxr-xr-x. 13 apache apache 4096 Apr 24 17:24 wiki
restart apache and finalize install
~$ sudo service httpd restart
Browse to your site's URL
it will let you know no LocalSettings.php file was found and give you a link to begin installation. This install script asks you a bunch of questions and will generate the LocalSettings.php based on your responses.
Save the LocalSettings.php file and copy to your site's directory, which in this case was:
~$ /var/www/html/johnssite/wiki/
If you opted for Image Uploads, it would have asked for which directory deleted files will go in, by default it is /var/www/html/johnssite/wiki/images/deleted/, so do the following:
~$ sudo mkdir /var/www/html/johnssite/wiki/images/deleted/ ~$ sudo chown apache:apache /var/www/html/johnssite/wiki/images/deleted/
Restart Apache
~$ sudo service httpd restart
Reload the page and your wiki should be operational or at least ready for further configuration.