MediaWiki + Ubuntu 11.04 & Customizations

  • Posted July 5, 2011. Last modified July 17, 2011 by

Recently, I setup a personal wiki for myself since I’m always encountering more information than I have time to read, but always want to go back later. Its also a way for me to organize topics I don’t know as much about as I’d like so that I can remember to come back to those areas later on. (Inspired by fellow UoG Student Eddia Ma: The default install from Ubuntu is pretty simple. I just installed it with the expected:

sudo apt-get install mediawiki

There are some simple steps to follow as you install with the package manager such as setting up the database and first configuration which should be easy enough to get through. However, the wiki required much customization before it would be good for what I was planning on using it for.

Citation Support

First of all, it had to support citations so that I could source the original papers, websites and others. This required the Cite Extension which can be downloaded here: (make sure you select the version that corresponds to the mediawiki version you have installed. Next extract to your extensions folder (likely /var/lib/mediawiki/extensions/ on Ubuntu 11.04). Finally add the following line to your mediawiki configuration file LocalSettings.php (likely in /etc/mediawiki).



I wanted to be able to attach papers directly into my wiki (pdfs and other documents from academic papers). For this I had to add the following line to my LocalSettings.php file (likely in /etc/mediawiki):

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

Additionally, I encountered problems uploading many larger pdfs since they are larger than the default php upload size. In ubuntu, this can be changed by modifying the php.ini file (likely located in /etc/php5/apache). Look for ‘upload_max_filesize’ and ‘post_max_size’ in order to change this to whatever size you like.


Of course being a CS student, I need to be able to add math equations into my wiki. The math formulas are entered using Latex which most CS grad students (and many undergrads) should know how to use. This one is in the Ubuntu repositories so it is easy to do:

sudo apt-get install mediawiki-math

Then you have to edit the LocalSettings.php file again (/etc/mediawiki) so that the wgUseTex flag is true:

$wgUseTeX = true;

Source Code – Syntax Highlighting

Again since I am a CS student, my wiki needs to be able to display source code easily in a readable way. For this I use the Ubuntu package manager again:

sudo apt-get install mediawiki-extensions-geshi

And edit the LocalSettings.php file (/etc/mediawiki) – For some reason, other instructions I have online have different paths and names for the plugin, so this will only work using the plugin from the repository. If you download it yourself directly, the name and location may be different:


Wiki Privacy

Lastly, as I previously mentioned the wiki is private (at least for now). To do this it is quite simple. Just paste this into the bottom of your LocalSettings.php file. (There are other variations on how private you can make the wiki, but if you want to do that, check out the official mediawiki page)

# Disable reading by anonymous users
# See:
$wgGroupPermissions['*']['read'] = false;

# But allow them to access the login page or else there will be no way to log in!
# NOTE: You also need to provide access here to the .css and .js files that the
# allowed pages attempt to load; otherwise, users will get errors on the page
# when they attempt to load it (IE will complain about the errors;
# FF will show them in its error console)
# [You also might want to add access to "Main Page", "Wikipedia:Help", etc.)
$wgWhitelistRead = array ("Special:Userlogin", "MediaWiki:Common.css",
"MediaWiki:Common.js", "MediaWiki:Monobook.css", "MediaWiki:Monobook.js", "-");

# Disable anonymous editing
$wgGroupPermissions['*']['edit'] = false;

# Prevent new user registrations except by sysops
$wgGroupPermissions['*']['createaccount'] = false;

6 comments on “MediaWiki + Ubuntu 11.04 & Customizations”



    I’ve actually poked around MediaWiki to see if there’s any support for making some pages private, and other pages public. It’s apparently against their overarching philosophy to have this feature. My solution is to have two installations — the public one that you’ve linked, and a separate private one.

    Incidentally, why did you post the URL to my wiki after it’s been rewritten? 😛 I always post “” instead. I used to have support for pretty URLs, but I reverted it after moving the path to the installation around a few times (easier to maintain).


      Good idea with the two installs, but such a pain to copy content between the wikis when I want to make things public. I wish there was a way to make a page public or private with a checkbox or something at the time of publishing.

      For the URL, its probably because I lazily copied whatever was in the URL bar when I posted it 😛 Its updated now with just /wiki 😀


    good deal; i’ve used a personal wiki for many years, and found it tremendously useful.

    eddie ma: expecting people to link to pre-rewritten uri’s is the dumbest thing i’ve seen a serious computer scientist (i presume) do in a long time. how would someone generally even know such a uri existed?

    i dig the blog, jason. keep it up.


    Incredible! I’m truly enjoying the design of your blog. Are you using a custom template or is this freely available to all individuals? If you really don’t want to say the name of it out
    in the general public, please contact me at: nina-foss@gawab.
    com. I’d really like to get my hands on this theme! Thanks a lot.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.