The aim of this tutorial is to have MediaWiki running on a Ubuntu PC. MediaWiki is basically a web based system which provides information to visitors. This information can be modified by multiple users. In companies it is used to documentation and collaboration purposes. The famous website “Wikipedia” has as its base system a MediaWiki.
To have MediaWiki running and online other components are required as well. A web server and a database server are needed. The web server handles the http requests from the web browsers and the database contains basically the information which is stored by MedaiWiki.
MediaWiki is written in the programming language PHP. PHP components need to be installed as well.
I use “Apache2” as web server and I use “MySQL” as database server in this tutorial. Both is open source software and available in the Ubuntu repositories.
1. Install Software
As a first step it is necessary to open a terminal with a bash and install the Apache2 web server, PHP and the MySQL database server and client:
sudo apt-get --yes install mysql-server apache2 sudo apt-get --yes install libapache2-mod-php php-mbstring sudo apt-get --yes php-xml php-intl php-mysql sudo a2enmod php7.4
2. Create a MySQL Database
As I wrote before the database keeps basically the information of the MediaWiki installation.
Run these commands to enter MySQL and to create a database:
sudo mysql -u root -p
Enter the Mysql Root password – in my case the password is blank.
mysql> CREATE DATABASE wiki;
The command above creates the database.
mysql> GRANT ALL PRIVILEGES ON wiki.* TO wikiuser@localhost IDENTIFIED BY 'secpasswd';
The command above creates a user called “wikiuser” with the password “secpasswd”. Then do this:
mysql> FLUSH PRIVILEGES; mysql> quit
3. Download MediaWiki to the right Directory
Now we need to download the latest stable version of MediaWiki. At the date of writing this blog post the following commands did the job:
sudo cd /var/www/html/ sudo wget https://releases.wikimedia.org/mediawiki/1.38/mediawiki-1.38.4.zip sudo unzip mediawiki-1.38.4.zip
The last command extracts the compressed zip file.
4. Install and Configure MediaWiki
Now we need to open the browser and connect to this address: “http://localhost/mediawiki-1.38.4/index.php” . Click on “set up the wiki”.
From now it is a quite intuitive process. Select the language for MediaWiki and continue.
On the page called “Connect to Database” we need to provide the setting which we set before in the step “2. Create a MySQL Database” of this tutorial.
Click on “Continue”
On the page called “Name”, set the name of the Wiki installation, set a username and a password. Later you will need the username and the password to log into the MediaWiki.
In our test lab situation we can safely click on “I’m bored already, just install the wiki.”
4. Download the Configuration
Download now the “LocalSettings.php” and copy it to “/var/www/html/mediawiki-1.38.4”.
Click finally the “Enter the Wiki”.
The process is basically not very complicated. A lot of web applications have a similar setup procedure. I will post soon an instruction about installing WordPress. I did a Joomla” tutorial already – click here to see it. That’s basically very close to what I posted today.
Keep in mind that there could problems with the PHP version arise. Not every MediaWiki version is compatible with all the PHP version. See here the MediaWiki requirments: https://www.mediawiki.org/wiki/Manual:Installation_requirements
Another issue could be that the MediaWiki is not accessible from other computers in the network. A host firewall could cause this problem.