Mediawiki/Installing
(43 intermediate revisions by one user not shown) | |||
Line 1: | Line 1: | ||
+ | [[Mediawiki/Installing|Installing]] | [[Mediawiki/MultipleInstances|Multiple Instances]] | [[Mediawiki/Installing/Ubuntu|Ubuntu Installation]] | [[Mediawiki/Installing/CentOS7|CentOS7 Installation]] | ||
+ | ==Installation Overview== | ||
+ | '''All instructions done on Oracle Linux 6.5''' <br> | ||
+ | Below are instructions for setting up a single instance of mediawiki on a server, however i've specifically included certain instructions in order to easily allow for multiple instances of mediawiki on the same server. If you want to configure multiple instances, once done with the the configuration below, you can go to the '''[[Mediawiki/MultipleInstances|Multiple Instances page.]]''' | ||
+ | |||
==install apache2== | ==install apache2== | ||
find the package name and install | find the package name and install | ||
Line 10: | Line 15: | ||
==install php & mysql== | ==install php & mysql== | ||
~$ sudo yum install php php-mysql php-gd mysql-server php-xml mysql | ~$ sudo yum install php php-mysql php-gd mysql-server php-xml mysql | ||
+ | |||
+ | ==setup mysql== | ||
+ | make sure mysql is started | ||
+ | ~$ sudo service mysqld status | ||
+ | or | ||
+ | ~$ sudo service mysqld start | ||
+ | setup the basics | ||
+ | ~$ sudo mysql_secure_installation | ||
+ | Set root password? [Y/n] y | ||
+ | Remove anonymous users? [Y/n] y | ||
+ | Disallow root login remotely? [Y/n] y | ||
+ | Remove test database and access to it? [Y/n] y | ||
+ | Reload privilege tables now? [Y/n] y | ||
+ | login to db | ||
+ | ~$ mysql -u root -p | ||
+ | Create mysql wiki user | ||
+ | ~$ mysql> CREATE USER 'wiki'@'localhost' IDENTIFIED BY 'THISpasswordSHOULDbeCHANGED'; | ||
+ | ~$ mysql> exit | ||
+ | login as new user to verify account works | ||
+ | ~$ mysql -u wiki -p | ||
+ | ~$ mysql> exit | ||
+ | create DB | ||
+ | ~$ mysql -u root -p | ||
+ | ~$ mysql> CREATE DATABASE sewikidatabase; | ||
+ | verify DB creation | ||
+ | ~$ mysql> SHOW DATABASES; | ||
+ | assign rights to wiki user for new database created | ||
+ | ~$ mysql> GRANT ALL PRIVILEGES ON sewikidatabase.* TO 'wiki'@'localhost' IDENTIFIED BY 'wikiuserpassword' WITH GRANT OPTION; | ||
+ | ~$ mysql> exit | ||
+ | verify permissions have been granted | ||
+ | ~$ mysql -u wiki -p | ||
+ | ~$ mysql> SHOW GRANTS; | ||
+ | +---------------------------------------------------------------------------------------------------------------+ | ||
+ | | Grants for wiki@localhost | | ||
+ | +---------------------------------------------------------------------------------------------------------------+ | ||
+ | | GRANT USAGE ON *.* TO 'wiki'@'localhost' IDENTIFIED BY PASSWORD '*2K21458K438UYE85A38B9Y7Y78DAEBF4T8689YK4' | | ||
+ | | GRANT ALL PRIVILEGES ON `sewikidatabase`.* TO 'wiki'@'localhost' WITH GRANT OPTION | | ||
+ | +---------------------------------------------------------------------------------------------------------------+ | ||
+ | 1 row in set (0.00 sec) | ||
+ | ==set apache and mysql to start on boot== | ||
+ | ~$ chkconfig httpd on | ||
+ | ~$ chkconfig mysqld on | ||
+ | ==download mediawiki and verify== | ||
+ | http://www.mediawiki.org/wiki/Download<br> | ||
+ | http://da44en.wordpress.com/2004/08/16/practical-gnupg/<br> | ||
+ | mediawiki | ||
+ | ~$ wget http://releases.wikimedia.org/mediawiki/1.22/mediawiki-1.22.6.tar.gz | ||
+ | gpg signature | ||
+ | ~$ wget http://releases.wikimedia.org/mediawiki/1.22/mediawiki-1.22.6.tar.gz.sig | ||
+ | gpg keys | ||
+ | ~$ wget wget https://www.mediawiki.org/keys/keys.txt | ||
+ | import keys | ||
+ | ~$ gpg --import keys.txt | ||
+ | verify file with detached sig | ||
+ | ~$ gpg --verify mediawiki-1.22.6.tar.gz.sig mediawiki-1.22.6.tar.gz | ||
+ | gpg: Signature made Thu 24 Apr 2014 07:42:22 PM EDT using RSA key ID 7F901A30 | ||
+ | gpg: Good signature from "Mark A. Hershberger <[email protected]>" | ||
+ | gpg: WARNING: This key is not certified with a trusted signature! | ||
+ | gpg: There is no indication that the signature belongs to the owner. | ||
+ | Primary key fingerprint: 3CEF 8262 806D 3F0B 6BA1 DBDD 7956 EE47 7F90 1A30 | ||
+ | This means the file was verified successfully | ||
+ | gpg: Good signature from "Mark A. Hershberger <[email protected]>" | ||
+ | ==create dir/export tar contents== | ||
+ | ~$ sudo mkdir /var/www/html/sitename.com | ||
+ | ~$ tar -C /var/www/html/sitename.com -zxf mediawiki-1.22.6.tar.gz | ||
+ | ==configure apache== | ||
+ | make a backup of the default httpd.conf | ||
+ | ~$ sudo cp /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.conf.default | ||
+ | make sure that the following is in your httpd.conf and is NOT commented out | ||
+ | Include conf.d/*.conf | ||
+ | also in httpd.conf make sure to specify your host's name | ||
+ | ServerName server.fqdn.com | ||
+ | Make a new conf file just for this site under /etc/httpd/conf.d/<br> | ||
+ | edit domain.conf | ||
+ | ~$ sudo vi /etc/httpd/conf.d/domain.conf | ||
+ | add: | ||
+ | <VirtualHost *:80> | ||
+ | ServerName servername.com | ||
+ | ServerAdmin [email protected] | ||
+ | DocumentRoot /var/www/html/servername/mediawiki-1.22.6/ | ||
+ | TransferLog logs/servername-access_log | ||
+ | ErrorLog logs/servername-error_log | ||
+ | </VirtualHost> | ||
+ | |||
+ | ==discover httpd user name== | ||
+ | ~$ cat /etc/passwd | ||
+ | root:x:0:0:root:/root:/bin/bash | ||
+ | bin:x:1:1:bin:/bin:/sbin/nologin | ||
+ | daemon:x:2:2:daemon:/sbin:/sbin/nologin | ||
+ | adm:x:3:4:adm:/var/adm:/sbin/nologin | ||
+ | lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin | ||
+ | sync:x:5:0:sync:/sbin:/bin/sync | ||
+ | shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown | ||
+ | halt:x:7:0:halt:/sbin:/sbin/halt | ||
+ | mail:x:8:12:mail:/var/spool/mail:/sbin/nologin | ||
+ | uucp:x:10:14:uucp:/var/spool/uucp:/sbin/nologin | ||
+ | operator:x:11:0:operator:/root:/sbin/nologin | ||
+ | games:x:12:100:games:/usr/games:/sbin/nologin | ||
+ | gopher:x:13:30:gopher:/var/gopher:/sbin/nologin | ||
+ | ftp:x:14:50:FTP User:/var/ftp:/sbin/nologin | ||
+ | nobody:x:99:99:Nobody:/:/sbin/nologin | ||
+ | dbus:x:81:81:System message bus:/:/sbin/nologin | ||
+ | vcsa:x:69:69:virtual console memory owner:/dev:/sbin/nologin | ||
+ | rpc:x:32:32:Rpcbind Daemon:/var/cache/rpcbind:/sbin/nologin | ||
+ | ntp:x:38:38::/etc/ntp:/sbin/nologin | ||
+ | saslauth:x:499:76:"Saslauthd user":/var/empty/saslauth:/sbin/nologin | ||
+ | postfix:x:89:89::/var/spool/postfix:/sbin/nologin | ||
+ | rpcuser:x:29:29:RPC Service User:/var/lib/nfs:/sbin/nologin | ||
+ | nfsnobody:x:65534:65534:Anonymous NFS User:/var/lib/nfs:/sbin/nologin | ||
+ | abrt:x:173:173::/etc/abrt:/sbin/nologin | ||
+ | haldaemon:x:68:68:HAL daemon:/:/sbin/nologin | ||
+ | sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin | ||
+ | tcpdump:x:72:72::/:/sbin/nologin | ||
+ | oprofile:x:16:16:Special user account to be used by OProfile:/home/oprofile:/sbin/nologin | ||
+ | adminuser:x:500:500::/home/adminuser:/bin/bash | ||
+ | apache:x:48:48:Apache:/var/www:/sbin/nologin | ||
+ | mysql:x:27:27:MySQL Server:/var/lib/mysql:/bin/bash | ||
+ | the user we want is | ||
+ | apache:x:48:48:Apache:/var/www:/sbin/nologin | ||
+ | ==give folder rights to apache user== | ||
+ | ~$ sudo chown -R apache:apache /var/www/html/servername/mediawiki-1.22.6/ | ||
+ | verify | ||
+ | ~$ ls -la /var/www/html/servername/ | ||
+ | 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<br> | ||
+ | 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.<br> | ||
+ | Save the LocalSettings.php file and copy to your site's directory, which in this case was: | ||
+ | ~$ /var/www/html/servername/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/servername/mediawiki-1.22.6/images/deleted/, so do the following: | ||
+ | ~$ sudo mkdir /var/www/html/servername/mediawiki-1.22.6/images/deleted/ | ||
+ | ~$ sudo chown apache:apache /var/www/html/servername/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. |
Latest revision as of 01:07, 13 August 2022
Installing | Multiple Instances | Ubuntu Installation | CentOS7 Installation
[edit] Installation Overview
All instructions done on Oracle Linux 6.5
Below are instructions for setting up a single instance of mediawiki on a server, however i've specifically included certain instructions in order to easily allow for multiple instances of mediawiki on the same server. If you want to configure multiple instances, once done with the the configuration below, you can go to the Multiple Instances page.
[edit] install apache2
find the package name and install
~$ sudo yum search apache Loaded plugins: security ... httpd.x86_64 : Apache HTTP Server ~$ sudo yum install httpd.x86_64
[edit] install php & mysql
~$ sudo yum install php php-mysql php-gd mysql-server php-xml mysql
[edit] setup mysql
make sure mysql is started
~$ sudo service mysqld status or ~$ sudo service mysqld start
setup the basics
~$ sudo mysql_secure_installation Set root password? [Y/n] y Remove anonymous users? [Y/n] y Disallow root login remotely? [Y/n] y Remove test database and access to it? [Y/n] y Reload privilege tables now? [Y/n] y
login to db
~$ mysql -u root -p
Create mysql wiki user
~$ mysql> CREATE USER 'wiki'@'localhost' IDENTIFIED BY 'THISpasswordSHOULDbeCHANGED'; ~$ mysql> exit
login as new user to verify account works
~$ mysql -u wiki -p ~$ mysql> exit
create DB
~$ mysql -u root -p ~$ mysql> CREATE DATABASE sewikidatabase;
verify DB creation
~$ mysql> SHOW DATABASES;
assign rights to wiki user for new database created
~$ mysql> GRANT ALL PRIVILEGES ON sewikidatabase.* TO 'wiki'@'localhost' IDENTIFIED BY 'wikiuserpassword' WITH GRANT OPTION; ~$ mysql> exit
verify permissions have been granted
~$ mysql -u wiki -p ~$ mysql> SHOW GRANTS; +---------------------------------------------------------------------------------------------------------------+ | Grants for wiki@localhost | +---------------------------------------------------------------------------------------------------------------+ | GRANT USAGE ON *.* TO 'wiki'@'localhost' IDENTIFIED BY PASSWORD '*2K21458K438UYE85A38B9Y7Y78DAEBF4T8689YK4' | | GRANT ALL PRIVILEGES ON `sewikidatabase`.* TO 'wiki'@'localhost' WITH GRANT OPTION | +---------------------------------------------------------------------------------------------------------------+ 1 row in set (0.00 sec)
[edit] set apache and mysql to start on boot
~$ chkconfig httpd on ~$ chkconfig mysqld on
[edit] download mediawiki and verify
http://www.mediawiki.org/wiki/Download
http://da44en.wordpress.com/2004/08/16/practical-gnupg/
mediawiki
~$ wget http://releases.wikimedia.org/mediawiki/1.22/mediawiki-1.22.6.tar.gz
gpg signature
~$ wget http://releases.wikimedia.org/mediawiki/1.22/mediawiki-1.22.6.tar.gz.sig
gpg keys
~$ wget wget https://www.mediawiki.org/keys/keys.txt
import keys
~$ gpg --import keys.txt
verify file with detached sig
~$ gpg --verify mediawiki-1.22.6.tar.gz.sig mediawiki-1.22.6.tar.gz gpg: Signature made Thu 24 Apr 2014 07:42:22 PM EDT using RSA key ID 7F901A30 gpg: Good signature from "Mark A. Hershberger <[email protected]>" gpg: WARNING: This key is not certified with a trusted signature! gpg: There is no indication that the signature belongs to the owner. Primary key fingerprint: 3CEF 8262 806D 3F0B 6BA1 DBDD 7956 EE47 7F90 1A30
This means the file was verified successfully
gpg: Good signature from "Mark A. Hershberger <[email protected]>"
[edit] create dir/export tar contents
~$ sudo mkdir /var/www/html/sitename.com ~$ tar -C /var/www/html/sitename.com -zxf mediawiki-1.22.6.tar.gz
[edit] configure apache
make a backup of the default httpd.conf
~$ sudo cp /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.conf.default
make sure that the following is in your httpd.conf and is NOT commented out
Include conf.d/*.conf
also in httpd.conf make sure to specify your host's name
ServerName server.fqdn.com
Make a new conf file just for this site under /etc/httpd/conf.d/
edit domain.conf
~$ sudo vi /etc/httpd/conf.d/domain.conf add: <VirtualHost *:80> ServerName servername.com ServerAdmin [email protected] DocumentRoot /var/www/html/servername/mediawiki-1.22.6/ TransferLog logs/servername-access_log ErrorLog logs/servername-error_log </VirtualHost>
[edit] discover httpd user name
~$ cat /etc/passwd root:x:0:0:root:/root:/bin/bash bin:x:1:1:bin:/bin:/sbin/nologin daemon:x:2:2:daemon:/sbin:/sbin/nologin adm:x:3:4:adm:/var/adm:/sbin/nologin lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin sync:x:5:0:sync:/sbin:/bin/sync shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown halt:x:7:0:halt:/sbin:/sbin/halt mail:x:8:12:mail:/var/spool/mail:/sbin/nologin uucp:x:10:14:uucp:/var/spool/uucp:/sbin/nologin operator:x:11:0:operator:/root:/sbin/nologin games:x:12:100:games:/usr/games:/sbin/nologin gopher:x:13:30:gopher:/var/gopher:/sbin/nologin ftp:x:14:50:FTP User:/var/ftp:/sbin/nologin nobody:x:99:99:Nobody:/:/sbin/nologin dbus:x:81:81:System message bus:/:/sbin/nologin vcsa:x:69:69:virtual console memory owner:/dev:/sbin/nologin rpc:x:32:32:Rpcbind Daemon:/var/cache/rpcbind:/sbin/nologin ntp:x:38:38::/etc/ntp:/sbin/nologin saslauth:x:499:76:"Saslauthd user":/var/empty/saslauth:/sbin/nologin postfix:x:89:89::/var/spool/postfix:/sbin/nologin rpcuser:x:29:29:RPC Service User:/var/lib/nfs:/sbin/nologin nfsnobody:x:65534:65534:Anonymous NFS User:/var/lib/nfs:/sbin/nologin abrt:x:173:173::/etc/abrt:/sbin/nologin haldaemon:x:68:68:HAL daemon:/:/sbin/nologin sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin tcpdump:x:72:72::/:/sbin/nologin oprofile:x:16:16:Special user account to be used by OProfile:/home/oprofile:/sbin/nologin adminuser:x:500:500::/home/adminuser:/bin/bash apache:x:48:48:Apache:/var/www:/sbin/nologin mysql:x:27:27:MySQL Server:/var/lib/mysql:/bin/bash
the user we want is
apache:x:48:48:Apache:/var/www:/sbin/nologin
[edit] give folder rights to apache user
~$ sudo chown -R apache:apache /var/www/html/servername/mediawiki-1.22.6/
verify
~$ ls -la /var/www/html/servername/ 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
[edit] 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/servername/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/servername/mediawiki-1.22.6/images/deleted/, so do the following:
~$ sudo mkdir /var/www/html/servername/mediawiki-1.22.6/images/deleted/ ~$ sudo chown apache:apache /var/www/html/servername/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.