MediaWiki is a free and open-source wiki software tool used to build Wikipedia-like websites. It is written in PHP and allows for data to be written to a read-write database and read from read-only databases. It is used by students, teachers, and businesses to create materials, resources, and instructional presentations. It comes with a user-friendly web interface that helps you to add and edit wiki content, creating a group-moderated website.

In this post, we will show you how to install MediaWiki on Arch Linux.

Step 1 – Configure Repository

By default, the default repository is outdated in Arch Linux, so you will need to modify the default mirror list. You can do it by editing the mirror list configuration file:

nano  /etc/pacman.d/mirrorlist

Remove all lines and add the following lines:

## Score: 0.7, United States
Server =$repo/os/$arch
## Score: 0.8, United States
Server =$repo/os/$arch
Server =$repo/os/$arch
## Score: 0.9, United Kingdom
Server =$repo/os/$arch
## Score: 1.5, United Kingdom
Server =$repo/os/$arch
Server =$repo/os/$arch
## Score: 6.6, United States
Server =$repo/os/$arch
## Score: 6.7, United States
Server =$repo/os/$arch
## Score: 6.8, United States
Server =$repo/os/$arch
## Score: 7.1, India
Server =$repo/os/$arch
## Score: 10.1, United States
Server =$repo/os/$arch

Save and close the file, then update all the package indexes with the following command:

pacman -Syu

Step 2 – Install Nginx

By default, the Nginx package is included in the Arch Linux default repository. You can install it with the following command.

pacman -S nginx-mainline

After installing the Nginx, start and enable the Nginx service using the following command.

systemctl start nginx
systemctl enable nginx

Step 3 – Install and Configure PHP

MediaWiki is a PHP-based application, so you will also need to install PHP and other extensions to your server. You can install all of them using the following command.

pacman -S php php-fpm php-gd unzip

Next, edit the PHP configuration file and enable all the required PHP extensions.

nano /etc/php/php.ini

Add / Modify the following lines:

memory_limit = 512M
post_max_size =32M
upload_max_filesize = 32M
date.timezone = Asia/Kolkata


Save and close the file, then start the PHP-FPM service and enable it to start at system reboot.

systemctl start php-fpm
systemctl enable php-fpm

Step 4 – Install and Configure MariaDB Database

First, install MariaDB with the following command.

pacman -S mariadb

Once the MariaDB server is installed, initialize the MariaDB database with the following command.

mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql

Next, start and enable the MariaDB service using the following command.

systemctl start mysqld
systemctl enable mysqld

Next, connect to the MariaDB shell:


Next, create a database and user using the following command.

GRANT ALL ON mediawiki.* TO mediawiki@localhost IDENTIFIED BY 'securepassword';

Next, flush the privileges and exit from the MariaDB shell with the following command.

Step 5 – Download Mediawiki

First, download the latest version of MediaWiki from their official download page using the following command.


Once the download is finished, extract the downloaded file with the following command.


Next, create an Nginx web root directory and move Mediawiki inside the Nginx web root.

mkdir -p /var/www/html/
mv mediawiki-1.39.2 /var/www/html/mediawiki

Next, change the ownership of the Mediawiki directory.

chown -R http:http /var/www/html/mediawiki/

Step 6 – Configure Nginx for Mediawiki

Next, you will need to create an Nginx virtual host configuration file to serve Mediawiki.

First, create a directory to store Nginx virtual host.

mkdir /etc/nginx/sites-enabled

Next, create an Nginx configuration file for MediaWiki.

nano /etc/nginx/sites-enabled/mediawiki.conf

Add the following configurations.

server {
        listen 80;

        root /var/www/html/mediawiki;
        index index.php;
        error_log /var/log/nginx/mediawiki.error;
        access_log /var/log/nginx/mediawiki.access;

        location / {
                try_files $uri $uri/ /index.php;

        location ~ /\.ht {
          deny all;

        location ~ \.php$ {
	    fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            include fastcgi_params;

Save the file, then edit the Nginx main configuration file.

nano /etc/nginx/nginx.conf

Add the following lines after http{:

server_names_hash_bucket_size 64;
include sites-enabled/*;

Save the file when you are done. Then, verify the Nginx configuration.

nginx -t

You will see the following output.

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

Next, restart the Nginx service to implement the changes.

systemctl restart nginx

Step 7 – Perform Mediawiki Web Installation

Now, open your web browser and access Mediawiki using the URL You should see the following screen.
MediaWIki welcome screen
Click on the Set up the wiki. You should see the language selection screen.
MediaWIki language selction screen
Select your language and click on the Continue button. You should see the terms of service page.
MediaWIki term of service screen
Read the term of service and click on the Continue button. You should see the database settings page.
MediaWIki database screen
Define your database settings and click on the Continue button. You should see the following page.
MediaWIki database confirmationscreen
Click on the Continue button. You should see the Mediawiki site configuration page:
MediaWIki site configuration screen
Define your site name, admin username, and password, and click on the Continue button. You should see the following page:
MediaWIki site installation screen

Click on the Continue button. Once the installation has been finished, you should see the following page.
Mediawiki installation done
Click on the enter your wiki. You should see your Mediawiki dashboard on the following screen.
mediawiki dashboard


Congratulations! You have successfully installed Mediawiki with Nginx on Arch Linux. You can now start deploying your own Wiki website using MediaWiki. You can also try Mediawiki on dedicated server hosting from Atlantic.Net!