How to Install MediaWiki on CentOS 7 or RHEL 7 Server

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 browser 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 and 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 :

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

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

[[email protected] ~]# mysql -u root -p

mysql> CREATE DATABASE mediawiki_db;

mysql> GRANT ALL PRIVILEGES ON mediawiki_db.* TO 'wiki_user'@'localhost' IDENTIFIED BY '[email protected]@123#' WITH GRANT OPTION;

mysql> FLUSH PRIVILEGES;

mysql> exit;

mediawiki_database_linux

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

Step:4 Download MediaWiki 1.24.2 with 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

[[email protected] ~]# wget https://releases.wikimedia.org/mediawiki/1.24/mediawiki-1.24.2.tar.gz

Untar the downloaded file using below tar command.

[[email protected] ~]# tar -zxpvf mediawiki-1.24.2.tar.gz

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

[[email protected] ~]# mv mediawiki-1.24.2 /var/www/html/mediawiki
Step:5 Set the required permissions on mediawiki directory
[[email protected] ~]# chown -R apache:apache /var/www/html/mediawiki/
[[email protected] ~]# chmod 755 /var/www/html/mediawiki/
[[email protected] ~]#
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.

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

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

[[email protected] ~]# getenforce
Enforcing
[[email protected] ~]# restorecon -FR /var/www/html/mediawiki/

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

MediaWiki-Web-installation

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

Define the Language for MediaWiki

MediaWiki_language

Click On Continue

MediaWiki Environment Setup Check :

mediawiki-setup-check

Click On Continue…

Define the Mediawiki database, database user name and Password.

MediaWiki-database-username

MediaWiki Database Settings

MediaWiki-database-engine

Define Name of Wiki and its Administrator Account

Mediawik-admin-account

Click on Continue to finish the installation

click_continue_to_finish_installation

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

mediawiki-installation-completed

Now visit the Main page ( http://192.168.1.14/mediawiki/index.php/Main_Page) and Login Admin Panel of Mediawiki

mediawiki-main-page

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

Log-in-Mediawiki-admin

mediawiki-admin-panel-page

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

6 Responses

  1. Abhilash Ashokan says:

    This information made me feel better.Its tremendous to learn the basic installation of media wiki.Hope all will refer this to complete their successfull installation of mediawiki

  2. BK says:

    This article is of great help. I’ve successfully installed my own wiki using this as a reference.

  3. Gerson says:

    Thank you!!!!!

  4. Laurier Baribeau says:

    On my CentOS 7 system, I had to substitute mysqld with mariadb when I got “Nothing to do” (not found) : ie. yum install mariadb-server – hope this helps somebody. Thanks for this helpful reference

  5. Oliver Russell says:

    Is the process of installing mediawiki the same for shared hosting and cloud hosting platforms? I followed your tutorial and another tutorial (‘https://www.cloudways.com/blog/install-mediawiki/’ ) to install it. However, when i try to access the domain i am getting 500 internal server error.

  6. Raghu says:

    mysql -u root -p
    Which password we need to give. Root password not working.

Leave a Reply to BK Cancel reply

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

Pin It on Pinterest