How to Install MediaWiki on Centos?

By on October 24th, 2018

How to Install MediaWiki on Centos?

MediaWiki is a free web-based wiki platform which is written in PHP.  It was originally created for Wikipedia with very powerful capabilities. MediaWiki is now used by several other projects of the non-profit Wikimedia Foundation and by many other wikis. MediaWiki is very easy to install does not take much time to complete. Some of the MediaWiki used websites are Wikipedia, Wiktionary etc. To install MediaWiki your server must contain a web server (Apache), PHP and a database server. In this let’s have a look into how can we install MediaWiki on Centos.

1) Login to your server via SSH.

# ssh root@IP

2) Download the latest version of MediaWiki from their official website.

# wget

3) Untar the file to the document root of Apache.

# tar -xzvf mediawiki-1.19.2.tar.gz -C /var/www/html

4) You can easily find out the Apache’s document root by executing the following command.

# grep ‘^DocumentRoot’ /etc/httpd/conf/httpd.conf

5) You can rename the MediaWiki directory to a preferred one.

# mv /var/www/html/mediawiki-1.19.2 /var/www/html/mediawiki

6) The MediaWiki files must be owned by Apache.

# chown -R apache:apache

7) MediaWiki uses MySQL user and database. In order to create one, you can execute 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

8) Now the installation process of MediaWiki has been successfully completed from CLI. You will need to do the rest from the web browser.

9) Open your favorite web browser and navigate to and follow the onscreen instructions to complete the rest of installation. It will check the requirements and running the software. You will be needed to enter the database details and also must create an admin password. Once the GUI installation is completed, the MediaWiki will generate a ‘LocalSettings.php file.

Download the LocalSettings.php file, open the file and copy its contents.

10) Now open your favorite text editor and paste the copied contents to it.

# vi /var/www/html/wiki/LocalSettings.php

Finally, we have installed MediaWiki on Centos server. If you have any doubt regarding this, please do reach our support department.


If you need any further assistance please contact our support department.


Leave a Reply