5.5 C
Sunday, January 17, 2021

How to install MediaWiki on Debian 9?

Must read

Please Donate

Senior Writer and partner

The Wikis help many to publish useful information about the programs. Even in the education sector wikis play an important role in describing detailed information. Therefore, in this article, I will show you how to install MediaWiki on Debian 9.

MediaWiki is an open source application written in PHP. Basically, it allows creating a wiki for our project in a simple way. It is used by many community and noncommunity projects to provide information to its users. Ideal for educational purposes, for example.

In like manner, MediaWiki has an API that developers can use to extend their projects. All this with great community support.

So, let us start to install MediaWiki on Debian 9.

1. Install Apache web server

The first step is to install Apache web server because MediaWiki is a web application. So let us install it.

:~$ su
:~# apt install apache2

1.- Apache web server
1.- Apache web server

When the installation is complete, Debian configures Apache to start by default. So now you can check the status of the service.

:~# systemctl status apache2

2.- Apache status
2.- Apache status

So, Apache is properly running.

2. Install PHP 7.3

Debian 9 Stretch has PHP 7.0 in its official repositories. It’s a great version of PHP but it’s getting a little out of date. So let’s install PHP 7.3 on Debian 9.

For it, we have a brilliant tutorial that you can follow in this link.

Next, install all the PHP modules required for MediaWiki.

:~#  apt install php7.3 php7.3-mysql libapache2-mod-php7.3 php7.3-xml php7.3-mbstring php7.3-apcu php7.3-intl  php7.3-gd php7.3-cli php7.3-curl

3.- Install PHP 7.3
3.- Install PHP 7.3

After that, you can do some extra configuration on PHP. To increase the PHP memory handling capacity. To do it, edit the PHP configuration file.

:~# nano /etc/php/7.3/apache2/php.ini

And make the following changes

upload_max_filesize = 200M
memory_limit = 128M

Finally, restart Apache.

:~# systemctl restart apache2

3. Install MariaDB

Now it is MariaDB’s turn. MariaDB is a free and open source database manager. It is very easy to learn but robust in features.

So, let us install it.

:~# apt install mariadb-server

4.- Install Mariadb
4.- Install MariaDB

Next, set a root password using the mysql_secure_installation script.

:~# mysql_secure_installation

5.- Mysql_secure_installation
5.- Mysql_secure_installation

You will be asked some configuration questions. In my case, I will answer like this: Y, N, Y, Y.

Then, it is necessary to create a new database for MediaWiki. Besides a MariaDB user as well.

:~# mysql -u root -p
CREATE DATABASE mediawikidb;
GRANT ALL PRIVILEGES ON mediawikidb.* TO 'mediawikiuser'@'localhost' IDENTIFIED BY 'mediawikipss';

6.- MariaDB database
6.- MariaDB database

4. Install MediaWiki

Now you can install MediaWiki. To do this, you need to download it to the Apache root directory.

:~# cd /var/www/html/
:~# wget https://releases.wikimedia.org/mediawiki/1.32/mediawiki-1.32.1.tar.gz

7.- Download and install MediaWiki
7.- Download and install MediaWiki

After that, decompress it.

:~# tar -xfvz mediawiki-1.32.1.tar.gz

Next, remove the downloaded file and rename the generated folder.

:~# rm -r mediawiki-1.32.1.tar.gz
:~# mv mediawiki-1.32.1 mediawiki

So, open your web browser and access to your browser to start the installation. For example, http://SERVER_IP/mediawiki/mw-config/.

8.- Start the installation
8.- Start the installation

Then, it will show you a screen where you will see the software requirements and license terms.

9.- License terms
9.- License terms

Next, configure the database.

10.- Databases configuration
10.- Databases configuration

Next, choose the database engine.

11.- Database engine
11.- Database engine

Next, create the admin account. Scroll down and you have two choise, start the installation now or set some configuration.

12.- Admin account
12.- Admin account

In the next screen, you will be able to modify other options such as the sending of mail and the license of the articles.

13.- Some options
13.- Some options

Next, you can start the installation.

14.- Install MediaWiki
14.- Install MediaWiki

Now, the installation is complete.

16.- Installation complete
16.- Installation complete

Now, the screen shows a message where you have to download a configuration file and place it in the MediaWiki folder to complete the installation.

So, use the scp command on your host computer.

:~$ scp Path_file your-server:/home/your-home/

Then, on the server move it to the MediaWiki root directory.

:~# mv /home/your-home/LocalSettings.php /var/www/html/mediawiki/

Next, come back to your web browser and go to http://SERVER_IP/mediawiki/ and you will see your wiki.

17 mediawiki working
17 MediaWiki working

So, that is it.


Having your own wiki for your projects can be new and useful. Especially if it is a collaborative project where you can provide information from an easy way.

Share this post with your friends.

More articles


Please enter your comment!
Please enter your name here


Latest article