Adding MediaWiki

I think of local wiki pages as my personalized online help pages.  How often have you written something down in a notebook, or worse, a scrap of paper, and then can’t find it again when you need to reference it?  MediaWiki is what WikiPedia uses, so most of you are probably already familiar with it.  Now that you have a local webserver operational, adding a wiki server to it should be fairly trivial.

tmike@tmike-HP-ENVY-m7-Notebook:~$ sudo apt install mediawiki php-gd
Reading package lists… Done
Building dependency tree
Reading state information… Done
Package mediawiki is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package ‘mediawiki’ has no installation candidate

So it looks like we get to troubleshoot another packaging issue with 16.04.  For the faint of heart you might be wanting to fall back on 15.10 at this point, I recommend against it.  16.04 is LTS (long-term support) which means Canonical will support the 16.04 release far longer than it will support 15.10.  Also, this is probably a packaging issue that probably has an easy solution.  If the kernel was crashing or we were having problems with device drivers I might be singing a different tune.  The error message indicates that package mediawiki is not found in the repositories we are searching, so let’s see if we have all of the repos selected.  The easiest way to do this is with Synaptic Package Manager (remember the 1-2-3 punch after initial installation?).

Go to Settings | Repositories and look at the first two tabs and make sure everything is checked.  The first tab is for Ubuntu Software and the second tab is for Other Software.

So now we check with Dr. Google and see if this issue has already been seen in the wild.  It has been seen, basically Canonical has dropped MediaWiki from it’s repositories with 16.04.  Equally disappointing is that the documentation page maintained by Canonical is not updated to reflect reality, circa 16.04.

There are two Dr. Google hits of interest, not surprisingly one is from the MediaWiki site and one is from the Ubuntu help site.


Both pages reference files that you aren’t likely to have on your system after a clean install of 16.04.  This is a good place to describe difference between a tarball and a binary package file.  The MediaWiki page suggests downloading the latest MediaWiki tarball from their project page and extracting it into your web directory, wherever that is.  Further down it discusses configuring apache2 and editing this file:  /etc/mediawiki/apache.conf.

A tarball is similar to a winzip file, when extracted it creates a directory tree.  The problem with following the MediaWiki instructions is that just extracting the tarball doesn’t configure anything and then referencing a file under /etc is fine, except it doesn’t exist.  So the instructions imply that apache needs to be made aware of MediaWiki, which makes sense, and the mechanism to do so is missing, the /etc configuration file.  You might try looking for apache.conf under the extracted tarball directory tree and you won’t find it, use these commands:

cd <extraction point> (e.g. /var/lib/mediawiki)

find . -name “*.conf” -print

This will list all of the files that were extracted from the tarball that end with .conf.

So a tarball is a collection of files in a hierarchy, which is similar to a binary package file, but a package file is so much more.  For one thing there can be multiple directory trees that get extracted, e.g., man pages, library files as well as executable files.  More importantly a packaging system allows scripts to run at various points, e.g. when a package is installed you can run a post-installation script to configure the package.  This is all hidden from the user by the software developer who creates and distributes the package file.  So when Canonical distributes a MediaWiki binary package there is a lot of configuration and testing that has gone into creating that package file.  Since the MediaWiki package file is no longer available for Ubuntu, it doesn’t make sense for us to pursue this wiki server on a 16.04 Ubuntu distribution.