Installation Steps of MediaWiki on Linux

Overview :

Mediawiki is a free open source wiki software which is written in PHP and allows the visitors of your website to edit the pages and it also stores the version of history of editable pages in its database like MySQL or MariaDB.

A wiki can be defined as Content Management System (CMS) or a website whose contents are editable from the web broswer and its text is written using simplified markup language (known as ‘wiki markup’) or a rich-text editor. A wiki is differ from a blog or such system as the content is posted and created without any defined author and owner of the post.

In this post we will discuss the installation steps of MediaWiki 1.24 on CentOS 7 & RHEL 7

Step:1 Install the prerequisite OS packages using yum command.

For mediawiki installation on Linux we must first install Web server (Apache) , PHP and Database ( MySQL / MariaDB ). If they are not installed on your system , please use the below command to install :

[root@linuxtechi ~]# yum install httpd php php-mysql php-gd mysql-server php-xml php-intl mysql
Step:2 Start the Web Server and Database Service
[root@linuxtechi ~]# systemctl restart httpd.service ; systemctl enable httpd.service
[root@linuxtechi ~]# systemctl restart mysqld.service ; systemctl enable mysqld.service
Step:3 Create Mediawiki Database

Connect to your database using mysql command and execute the following commands

[root@linuxtechi ~]# mysql -u root -p

mysql> CREATE DATABASE mediawiki_db;

mysql> GRANT ALL PRIVILEGES ON mediawiki_db.* TO 'wiki_user'@'localhost' IDENTIFIED BY 'P@ssWord@123#' WITH GRANT OPTION;


mysql> exit;


Replace the database name, user name and its credentials in above commands as per your setup.

Step:4 Download MediaWiki 1.24.2 using wget command

At the time of writing this article, latest version of Mediawiki 1.24.2 was available. Please refer this link to get Latest version of MediaWiki

[root@linuxtechi ~]# wget

Untar the downloaded file using below tar command.

[root@linuxtechi ~]# tar -zxpvf mediawiki-1.24.2.tar.gz

Move mediawiki-1.24.2 to its document root (/var/www/html/mediawiki/)

[root@linuxtechi ~]# mv mediawiki-1.24.2 /var/www/html/mediawiki
Step:5 Set the required permissions on mediawiki directory
[root@linuxtechi ~]# chown -R apache:apache /var/www/html/mediawiki/
[root@linuxtechi ~]# chmod 755 /var/www/html/mediawiki/
[root@linuxtechi ~]#
Step:6 Now start the MediaWiki web based installation

Before starting the Installation , please check followings

If your system is running behind the iptables / firewall , then use below commands to open 80 port for mediawiki.

[root@linuxtechi ~]# firewall-cmd --zone=public --add-port=80/tcp --permanent
[root@linuxtechi ~]# firewall-cmd --reload
[root@linuxtechi ~]# iptables-save | grep 80
-A IN_public_allow -p tcp -m tcp --dport 80 -m conntrack --ctstate NEW -j ACCEPT
[root@linuxtechi ~]#

If Selinux is enable on your Linux box , then set the following Selinux rules on mediawiki folder

[root@linuxtechi ~]# getenforce
[root@linuxtechi ~]# restorecon -FR /var/www/html/mediawiki/

Now Open the web browser type http://<IP_Address_of_System>/mediawiki


Replace the ip address as per your setup . Click on “Set up the wiki

Define the Language for MediaWiki


Click On Continue

MediaWiki Environment Setup Check :


Click On Continue…

Define the Mediawiki database, database user name and Password.


MediaWiki Database Settings


Define Name of Wiki and its Administrator Account


Click on Continue to finish the installation


MediaWiki installation is completed. Now Download “LocalSettings.php” file and placed it under the mediawiki document root (/var/www/html/mediawiki/ )


Now visit the Main page ( and Login Admin Panel of Mediawiki


Click on Log In . Enter the Admin Credentials that we have set during the installation.



Hope you enjoy the installation steps. Please share you comments and feedback on this article.

Leave a Reply

Your email address will not be published. Required fields are marked *