24Dec/092
Installing MediaWiki on Linux – CentOS
In this post we will learn how to setup a MediaWiki on CentOS. MediaWiki requires Apache web server, a database server (we’ll use MySQL), and PHP version 5. I will explain step by step process of installing these required components.
- Install MySql server and mysql-php module
yum install mysql-server mysql php-mysql /sbin/chkconfig --levels 235 mysqld on /sbin/service mysqld start
- Change 'root' user password for mysql; Create mysql wiki database and user
mysql
mysql> USE mysql; mysql> UPDATE user SET Password=PASSWORD('newpassword') WHERE user='root'; mysql> FLUSH PRIVILEGES; mysql> CREATE DATABASE wiki; mysql> CREATE USER 'wikiuser'@'localhost' IDENTIFIED BY 'wikipassword'; mysql> GRANT ALL ON wiki.* TO 'wikiuser'@'localhost'; mysql> exit - Download the mediawiki, http://download.wikimedia.org/mediawiki/1.15/mediawiki 1.15.1.tar.gz
wget http://download.wikimedia.org/mediawiki/1.15/mediawiki-1.15.1.tar.gz
- Untar the mediawiki to /var/www/html and give write permissions for config folder (Assuming that /var/www/html is the DocumentRoot)
tar -xvvf mediawiki-1.15.1.tar.gz mv mediawiki-1.15.1 /var/www/html/wiki
- Change the ownership of the wiki directory and grant write permissions to the config directory.
chown -R apache:apache /var/www/html/wiki chmod a+w /var/www/html/wiki/config
- Restart the apache server.
/sbin/service httpd restart Stopping httpd: [ OK ] Starting httpd: [ OK ]
- Go to http://localhost/wiki/config/index.php
- Configure Wiki Admin username/password
- Configure MySQL database/username/password
- Click Done
- Move the config/LocalSettings.php file to the parent directory
mv /var/www/html/wiki/config/LocalSettings.php /var/www/html/wiki
- Access wiki http://localhost/wiki
December 21st, 2010 - 17:09
Typo in your MYSQL syntax. Step 2, Line 5 is missing a semi-colon ; at the end.
should read
mysql> CREATE USER ‘wikiuser’@'localhost’ IDENTIFIED BY ‘wikipassword’;
December 9th, 2011 - 18:33
Great walkthru. I’m relatively new to PHP and mySQL, but this article worked like a charm.
Many thanks.