Mediawiki is a free and open source software package written in PHP, developed by the Wikimedia Foundation. Mediawiki runs on many websites such as Wikipedia, Wiktionary and Wikimedia Commons. Mediawiki also known as a wiki engine is software that allows users to create and edit pages via a web browser.
In this tutorial, we will learn how to install and configure Mediawiki on Ubuntu-16.04 server.
A server runing Ubuntu-16.04.
A non-root user with sudo privileges setup on your server.
Before starting, update your system with the following command:
sudo apt-get update -ysudo apt-get upgrade -y
Once system is up-to-date, you will need to install LAMP stack on your server.
Change the ownership of mediawiki directory to www-data:
sudo www-data:www-data -R /var/www/html/mediawiki
Configuring the Database
Default Mariadb installation is not secure, so you will need to secure it first. You can secure it using mysql_secure_installation script:
Answer all the questions as follows:
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none):
OK, successfully used password, moving on...
Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.
You already have a root password set, so you can safely answer 'n'.
Change the root password? [Y/n] n
By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
Remove anonymous users? [Y/n] Y
Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] Y
By default, MariaDB comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] Y
- Dropping test database...
- Removing privileges on test database...
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] Y
All done! If you've completed all of the above steps, your MariaDB
installation should now be secure.
Thanks for using MariaDB!
Next, you will need to login MariaDB console and create a Database for the Mediawiki.
You can do this by running the following command:
mysql -u root -p
Enter the password for root user, you should see the following output:
Welcome to the MariaDB monitor. Commands end with ; or g.
Your MariaDB connection id is 106
Server version: 10.0.27-MariaDB-0ubuntu0.16.04.1 Ubuntu 16.04
Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.
Once you are logged in to MariaDB console, create a database and user with the following command:
MariaDB [(none)]> CREATE DATABASE mediawikidb;
Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> CREATE USER 'user'@'localhost' IDENTIFIED BY 'password';
Query OK, 0 rows affected (0.06 sec)
MariaDB [(none)]> GRANT ALL PRIVILEGES ON wikidb.* TO 'user'@'localhost';
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.01 sec)
MariaDB [(none)]> exit
Configure Apache for Mediawiki
Once database is configured, you will need to configure Apache for Mediawiki.
So, you will need to create new virtual host file for Mediawiki:
If you find your cPanel disk space filling up, or an email address has hit its disk space quota, cPanel has a helpful built in Email Disk Usage tool. This will provide you with a simple to understand breakdown of how much disk space each folder for a particular email...
Although WHM will normally automatically keep itself up to date, you may want to manually check for server updates / push through an update that is pending, or it may be that you have automatic updates switched off on your cPanel server. In this guide we will show you how...
You may sometimes need to manually adjust the PHP settings on your cPanel server – for example if a site is hitting the PHP memory, or file size upload limit. WHM allows you to quickly change the settings of any PHP version installed on the server when needed, using the...