How To Set up MediaWiki on Centos 7

In this article, we want to teach you How To Set up MediaWiki on Centos 7.

MediaWiki is the free open-source wiki software used to power Wikipedia and thousands of other wikis.

How To Set up MediaWiki on Centos 7

To install MediaWiki on Centos 7, you need some requirements first.


You need to log in to your server as a non-root user with sudo privileges. To do this, you can follow our article the Initial Server Setup with Centos 7.

Also, you need to have a LAMP stack installed on your server. To do this, you can check our article How to install the LAMP stack on centos 7.

Now follow the steps below to install MediaWiki on Centos 7.

Set up PHP Extensions on Centos 7

After you have installed the LAMP stack on Centos 7, you need to install a few PHP modules on your server that are required for installing MediaWiki.

Note: you need to have PHP 7.3 or higher version installed on your server. You can install PHP 7.3 on your server by following this article about How To Install PHP 7.3 on Centos 7.

First, install the XML extension with the following command:

sudo yum install php-xml

For internationalization support, you need to install the Intl extension with the command below:

sudo yum install php-intl

Then, install GD for image thumbnailing with the following command:

sudo yum install php-gd

Also, you need to install the mbstring extension with the command below:

sudo yum install php-mbstring

Now restart Apache on Centos 7 with the following command:

sudo systemctl restart httpd.service

Download MediaWiki on Centos 7

First, you need to check the MediaWiki Downloads Page to get the latest LTS version of MediaWiki.

Then, use the following command to download MediaWiki:

curl -O

Now use the following command to extract your downloaded file:

tar xvzf mediawiki-*.tar.gz

Here you need to move the MediaWiki file to the /var/www/ directory with the command below:

sudo mv mediawiki-1.35.4/* /var/www/html

Create MySQL Database on Centos 7

At this point, you need to create a MySQL database for your MediaWiki on your server.

First, log in to your MySQL shell with the following command:

mysql -u root -p

You will see that your prompt change to MariaDB [(none)]>.

Create your database with the following command on Centos 7, here we use my_wiki for the name of the database. You can choose your own name.


Now you need to create a new database user with the command below:


Remember to replace the name of the database and the user that you want to create. Also, choose a strong password for your user.

Flush your MySQL privileges on Centos 7 with the command below:


Now exit from your MySQL shell with the command below:


Access MediaWiki

At this point, you can access the MediaWiki web interface by typing your server’s IP address on your web browser:


On this page, select set up the Wiki. Then, you need to select a language and click continue.

The Next page should display your environment and it should say in green that The environment has been checked. You can install MediaWiki. Click Continue.

Now you are on the page with the MySQL settings for MediaWiki on Centos 7.

In this window, select MySQL or compatible for the database type. Then, enter the local host for the database host and enter the database name, username, and password that you have created before. And press continue.

MySQL settings for MediaWiki

In the next window, you can leave everything by default and press continue. Next, you will need to fill in the details of your wiki, like its name. You can also create the admin user for the wiki on this page.

In the other windows, you left settings untouched. If you want a specific setting enabled for your wiki, you might need to change something on one of these screens. Also, if you have installed XCache before, you will need to check that to enable it.

When you are done you will see:

successfully installed MediaWiki

To complete your MediaWiki installation on Centos 7, you will need to move a file called LocalSettings.php to your server. You should download this file before you close the above window.

Now, you need to upload the file to /var/www/html. To do this, first, open the file on your Centos 7 with your favorite text editor, here we use vi:

sudo vi /var/www/html/LocalSettings.php

Then, open the file on your computer and copy the contents into your SSH window. After you have saved the file, you can click enter your wiki on the MediaWiki installation window and your wiki should be ready to use.


At this point, you learn to set up and configure MediaWiki on Centos 7.

Hope you enjoy it.


Please enter your comment!
Please enter your name here

Latest Articles


Most Popular