MediaWiki Installation on Ubuntu 16.04 (includes skins and extensions)


MediaWiki is a wikipedia software that manages pages, revision history, and files. As a bonus, it allows for the systems administrators to personalize to their hearts' content with the abundance of community extensions, skins, and tools. This guide will go over installing MediaWiki and a few add-ons.

Installing MediaWiki on Ubuntu 16.04

Let's start by installing the packages that are needed. Most, if not all listed, are necessary for the MediaWiki installation to work.

Update the existing package list:

sudo apt update

Install the required packages for the installation:

sudo apt install php apache2 mysql-server php php-common git composer php-mysql php-cli php-cgi libapache2-mod-php php-json php-gd php-fpm php-xml php-mbstring php-mcrypt libapache2-mod-php7.0 zip unzip imagemagick

Open up the Apache2

sudo vim /etc/apache2/mods-enabled/dir.conf

index.php should be added to the beginning of the DirectoryIndex list like this so that php files are looked at before html files:

<IfModule mod_dir.c>
    DirectoryIndex index.php index.html index.cgi index.xhtml

Then run these commands to enable the rewrite module:

sudo a2enmod rewrite
service apache2 restart

Install Git and clone the latest version of MediaWiki to your system. Change some of the permissions and ownership of the files and then set up MediaWiki with composer:

git clone /var/www/mediawiki
cd /var/www/mediawiki/
chmod -R 755 /var/www/mediawiki/
chown www-data:www-data /var/www/mediawiki/ -R
composer install --no-dev

Activate the mysql prompt so that you can create the database and the proper permissions for it. You will need to change the password to the one you set when installing mysql.

mysql -u root -p
GRANT ALL PRIVILEGES ON wikidb.* TO 'wikiuser'@'localhost' IDENTIFIED BY 'P@ssw0rd';
flush privileges;

Edit the mediawiki.conf file so that it looks something like this:

vim /etc/apache2/sites-available/mediawiki.conf

<VirtualHost *:80>
ServerAdmin wiki@localhost
DocumentRoot /var/www/mediawiki/
ServerName localhost
<Directory /var/www/mediawiki/>
Options FollowSymLinks
AllowOverride All
Order allow,deny
allow from all
ErrorLog /var/log/apache2/mediawiki-error_log
CustomLog /var/log/apache2/mediawiki-access_log common

Enable this configuration file:

cd /etc/apache2/sites-available
a2ensite mediawiki.conf
cd /etc/apache2/sites-enabled
a2dissite 000-default.conf
service apache2 restart

You can create a soft link to access the MediaWiki configuration file from the web root directory like this:

ln -s /etc/apache2/sites-available/mediawiki.conf /var/www/mediawiki

Make sure you are allowing HTTP traffic to the web server.

Configuring MediaWiki

In order for the site to fully work, you will have to set up the database objects and the base configuration for the site. All of this configuration goes in the LocalSettings.php file which is automatically generated at the end of this section. You are able to go back and edit the LocalSettings.php file or even add your own after you go through this setup.

If you point your browser to your site URL, you should be directed to a site that looks like this:

MediaWiki Starting Page

Press complete the installation to continue on with installing MediaWiki.

The first few pages are pretty simple and straightforward.

Connect to database Page

Onece you get to the Connect to database page, make sure you use the same credentials that you used to set the MySQL database up with earlier. The options should look exactly like this if you were following the instructions line by line.

Database Options

Database Settings Page

The next page just asks for the Storage engine that you would want to use. Leaving at the default of InnoDB works fine. Change it if you prefer using the MyISAM engine.

Name Page

This page is pretty simple. This is where you give your Wiki a name that shows up on the tab at the top of the browser and on the main page.

This page also includes the Administrator account setup which is what you can use to manage user accounts and a few administrative things on the wiki.

If you select I'm bored already, just install the wiki at the bottom of the page, it will finish off the installation. Otherwise, you'll have to answer a few more questions as it says.


This page includes the User rights. If you want the wiki to allow anonymous access then you can set it to be Open wiki.

There is also the Copyright and license section which you don't need to change unless you have a copyright aor license you have to fill out.

There is also the Email settings section which allows for outbound emails in case extensions are added that could send emails or if a user tries to resset their password.

If you want to have skins added at this moment, you can put it in the directory that is referenced later on.

You can also set the logo and enable File uploads in the Images and File Uploads section.

There is the Advanced configuration which allows you to cache objects, this would speed up the site a little bit if you allow Memcached but you would have to go through more prompts to install it. This tutorial will not cover those extra options.

Install Page

Once you press continue, Mediawiki will be installed. This will go through the process of setting up the database things and doing some other miscellaneous things. This will take a little bit until it finishes and then you can press Continue and it will take you to the page where you'll download the LocalSettings.php file. Once you have the file downloaded, you can put the file in your web servers root directory (If you have been following this guide, that would be /var/www/mediawiki/).

Upload Branding to MediaWiki

scp ~/wiki.png >    user@yourwiki:/var/www/mediawiki/resources/assets/
scp ~/favicon.ico user@yourwiki:/var/www/mediawiki/resources/assets/

They should automatically change whenever the cache is cleared or possibly just when the page is refreshed.

You will need to install at least one skin before you can use the site. Below this goes through installing the Vector skin which is the default skin used for MediaWiki.

Installing Skins

The skin by default is the Vector skin. You will need to manually download this skin by running the commands below in order for the site to work first try.

If you wanted to change the default Vector skin, you will have to edit your LocalSettings.php file and change $wgDefaultSkin to the name of the skin that you want as the default.

Installing Vector skin

Vector is the basic skin that Awnix has gotten comfortable with using.

git clone /var/www/mediawiki/skins/Vector
echo 'wfLoadSkin( "Vector" );' >> /var/www/mediawiki/LocalSettings.php

Installing Extensions

There are a few extensions that have proven to be useful on the internal company's wiki. These are a few that we have and encourage you to also get.

FancyBoxThumbs Extension

This is an extension that allows users to be able to view an image as a thumbnail instead of having to go to a new tab or the image's page.

git clone /var/www/mediawiki/extensions/FancyBoxThumbs/
echo 'require_once "$IP/extensions/FancyBoxThumbs/FancyBoxThumbs.php";' >> /var/www/mediawiki/LocalSettings.php

MultiUpload Extension

This extension allows users to upload multiple files at the same time.

git clone /var/www/mediawiki/extensions/MultiUpload
echo 'wfLoadExtension( "MultiUpload" );' >> /var/www/mediawiki/LocalSettings.php

WikiEditor Extension

This extension allows for a more efficient and useful toolbar when editing source pages.

git clone /var/www/mediawiki/extensions/WikiEditor
echo 'wfLoadExtension( "WikiEditor" );
$wgDefaultUserOptions["usebetatoolbar"] = 1;' >> /var/www/mediawiki/LocalSettings.php

Miscellaneous Configurations

Max File Upload Size

I recommend to change the default max file upload size for the wiki to something larger than 2MB.

It will max out at 8MB unless you change some other configuration file but 8MB is fine anyways.

Change the $upload_max_filesize line in /etc/php/7.0/apache2/php.ini to something bigger than just 2M:

upload_max_filesize =     100M

Change the $wgMaxUploadSize line in /var/www/mediawiki/includes/DefaultSettings.php to this:

$wgMaxUploadSize = 1024 * 1024 * 100; # 100MB

LocalSettings.php File

This is the file that holds the configuration for the MediaWiki installation. This section goes over specific files that could be added on to the file or things to look out for in case you want to edit them later on.

If you want to allow anonymous editing, make sure $wgGroupPermissions looks like this:

$wgGroupPermissions['*']['edit'] = true;

If you want to allow other non-default file types to be uploaded to the wiki, make sure you set $wgStrictFileExtensions to False like this:

$wgStrictFileExtensions = false;

After setting the $wgStrictFileExtensions to False, change $wgFileExtensions to include file extensions like this:

$wgFileExtensions = array( 'png', 'gif', 'jpg', 'jpeg', 'doc',
    'xls', 'mpp', 'pdf', 'ppt', 'tiff', 'bmp', 'docx', 'xlsx',
    'pptx', 'ps', 'odt', 'ods', 'odp', 'odg', 'xcf'

If you want to brand your wiki then you will need to set $wgLogo and $wgFavicon to point to where both of those files will be (and include the correct filename of the image):

$wgLogo = "/resources/assets/wiki.png";
$wgFavicon = "/resources/assets/favicon.ico";

MediaWiki Sidebar

The sidebar on the left of the wikipedia is a function of the wiki that can allow navigation to any page from any page. This section goes over adding more links to make it more helpful in your environment.

Add MediaWiki:Sidebar after the index.php/ in the URL. For example

Edit using the wiki Edit source button at the top of the page. Change it to look like this.

* navigation
** mainpage|mainpage-description
** recentchanges-url|recentchanges
** Special:MultiUpload|Upload multiple files
** Special:Import|Import Files
** randompage-url|randompage
** helppage|help
* Projects
** Main_Page#Project Management
* Main Links
** Main_Page#Human_Resources|Human Resources
** Main_Page#Network|Network
** Main_Page#Software|Software
** Main_Page#Support|Support
** Main_Page#Miscellaneous|Miscellaneous


MediaWiki is a wikipedia software that allows for editing and revising wiki pages. This software allows for network administrators to also add helpful extensions that add functionality to a basic foundation of what MediaWiki already is.

If you liked this tutorial, please leave a comment below telling us what you thought and take a look at our other tutorials.

If you have any suggestions for other tutorials, please contact us via the Contact Us page.