Mediawiki/Installing

From r00tedvw.com wiki
(Difference between revisions)
Jump to: navigation, search
Line 1: Line 1:
 +
[[Mediawiki/Installing|Installing]] | [[Mediawiki/MultipleInstances|Multiple Instances]]
 
All instructions done on Oracle Linux 6.5<br>
 
All instructions done on Oracle Linux 6.5<br>
 
=Single Instance=
 
=Single Instance=

Revision as of 20:37, 28 April 2014

Installing | Multiple Instances All instructions done on Oracle Linux 6.5

Contents

 [hide

Single Instance

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.

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

install php & 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
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 <mah@everybody.org>"
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 <mah@everybody.org>"

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/
edit domain.conf

~$ sudo vi /etc/httpd/conf.d/domain.conf
add:
<VirtualHost *:80>
       ServerName servername.com
       ServerAdmin admin@servername.com
       DocumentRoot /var/www/html/servername/mediawiki-1.22.g/
       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
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/

Restart Apache

~$ sudo service httpd restart

Reload the page and your wiki should be operational or at least ready for further configuration.





Multiple Instances

If you've followed the instructions above for a single instance, adding multiple instances of mediawiki should be a snap.

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)
Personal tools
Namespaces

Variants
Actions
Navigation
Mediawiki