How to install MediaWiki on CentOS/Fedora
In this arcticle we will explain you how to install MediaWiki on your Centos or Fedora VPS. MediaWiki is free, web-based wiki platform written in PHP, with very powerful capabilities. It is one of the most popular application of this type in the world.
The installation of MediaWiki is very easy and it can be done in less than 10 minutes. Please note that you should have web server (Apache), PHP and database server (MySQL) installed on your linux vps to be able to run MediaWiki.
1. Go to MediaWiki’s official website and download the latest version of the platform:
# wget http://download.wikimedia.org/mediawiki/1.19/mediawiki-1.19.2.tar.gz
2. Now you should extract the downloaded tar.gz file in your Apache Document Root directory:
# tar -xzvf mediawiki-1.19.2.tar.gz -C /var/www/html
3. To find out Apache’s document root directory execute:
# grep '^DocumentRoot' /etc/httpd/conf/httpd.conf
4. Rename the extracted directory. In our case, we will rename the directory from ‘mediawiki-1.19.2’ to ‘mediawiki’:
# mv /var/www/html/mediawiki-1.19.2 /var/www/html/mediawiki
5. All WikiMedia’s files and directories should be owned by the Apache user, which in our case is user ‘apache’:
# chown -R apache:apache
6. MediaWIki requires MySQL user and database, so let’s create them by executing the following commands:
# echo "CREATE DATABASE wikidb;" | mysql -u root -p # echo "CREATE USER 'wikiuser'@'localhost' IDENTIFIED BY 'PASSWORD_HERE';" | mysql -u root -p # echo "GRANT ALL PRIVILEGES ON wikidb.* TO 'wikiuser'@'localhost';" | mysql -u root -p # echo "FLUSH PRIVILEGES;" | mysql -u root -p
With this step, the installation from the command line is finished. All the rest can be done from a web browser. All you need to do is to open http://yourdomain.tld/wiki and follow the on-screen instructions. MediaWiki will check if your server meets the requirements for installing and running the software, you will be prompted to set your MySQL user and database information and some other general settings. At the end of the installation, the MediaWiki installer will generate ‘LocalSettings.php’ file which provides all the configuration settings. You will need to copy the code from the screen and paste it in a file called ‘LocalSettings.php’ in the ‘/var/www/html/wiki’ directory. Execute:
# nano /var/www/html/wiki/LocalSettings.php
Paste the code, and save the file. That’s all.
PS. If you liked this post please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.