CoolTools - MediaWiki

The software we'll be using for that is MediaWiki:
MediaWiki is a free software open source wiki package written in PHP, originally for use on Wikipedia. It is now also used by several other projects of the non-profit Wikimedia Foundation and by many other wikis.

Get the software

Check the MediaWiki website for the current version. At the time of writing, that would be 1.20.5.
We're going to install curl to download the package without opening Firefox. Just to be nerdy. At the terminal, which you open via Dash (the button on the upper left corner of your screen), type:
sudo apt-get install curl
Now download the selected version of mediawiki:
curl -O
Extract this file. There is an archive manager with a GUI available, but... :
tar xvzf mediawiki-*.tar.gz
Move it to /etc/w:
sudo mv mediawiki-1.20.5 /etc/w
Now link this directory to /var/www (= the directory which will be public to your intranet):
sudo ln -s /etc/w /var/www

And for good measure, restart Apache:
sudo service apache2 restart

Set up the database

Using FireFox (third button on the column on the left of your screen), navigate to localhost/phpmyadmin. Log in with your root user account as set during MySQL installation, click Privileges and Add a new user:
  • User name: mediawiki
  • Host: localhost
  • Password: pick something or let it generate a password. You need to keep it handy for the installation of MediaWiki in the next section.

Under Database for user, tick Create database with same name and grant all privileges.


Using FireFox, go to localhost/w/index.php
MediaWiki will automatically start the setup process.
  1. Enter the credentials for the MySQL user and database for MediaWiki (which you just configured in PHPMyAdmin). There is no need for a table prefix as we created a dedicated database specifically for this wiki.
  2. Pick credentials for the MediaWiki admin and make sure to remember them.
  3. The user rights profile is well explained on the setup page itself. Pick whichever is right for you.
  4. You might want to enable email (user-to-user, talk page notification, watchlist notification, e-mail authentication). You might want to set the return e-mail address to your email address.
  5. When asked, enable the following extensions:
    The ParserFunctions extension enhances the wikitext parser with helpful functions, mostly related to logic and string-handling.
    The Renameuser extension provides a special page which allows authorized users to rename user accounts. This will cause page histories, etc. to be updated.
    The Vector extension adds a few enhancements to the Vector skin. Note that these features are only available in Vector, not in other skins.
    WikiEditor is an extendable framework with a set of feature-based modules that improve the user experience of editing. It is also the editing interface that Wikipedia currently uses.
  6. You might want to enable file uploads, so your users can upload images, pdf, documents, etc.
  7.  Caching is not required unless you’re having performance problems - you shouldn’t have performance problems with the limited audience of an intranet wiki, even if you’re not working for a tiny company.

After installation is complete, MediaWiki will give you a settings file to download. After downloading, open the file manager (second button in the column on the left of your screen), go to the Downloads folder, right-click the LocalSettings.php-file, Cut. Go to File System, etc, w. Right-click in the folder and Paste. Overwrite the existing file. 
Also, delete the mw-config folder.

Congratulations, you’ve got your basic wiki up and running! In the last page of the configuration (in FireFox), there's a link you can click to go to your actual wiki and see it live for the first time.


So now your wiki is up, but you can only access it from within your Virtual Machine. What you want is a wiki you can use from your regular operating system, and from everywhere in the network. To do that, we need to go to the Virtual Machine settings.
In the VirtualBox menu, pick Machine and then Settings. Under Network, you will find the virtual machine is coupled through NAT (Network Address Translation). You need to do a port forwarding (or port mapping). Click the appropriate button.
In the popup, click the little button in the top right corner to add a port forward. It will appear as a new line in the popup: Rule 1. Change both the Host port and Guest port to 80, the regular http-traffic port. Click OK to confirm.

Now try navigating to localhost/w with the browser on your regular operating system (not inside the virtual machine), and you will see you also get to the wiki!

To access the wiki from a different machine in the network, you need to know the IP address of the machine that is running the Virtual Machine. If the operating system you're using is Windows, you can do this by:
  1. Click Start.
  2. Type cmd + enter to open the command line.
  3. Type ipconfig
Depending on your configuration, you might get a number of entries. Typically there will only be 2 with an IP (IPv4) address assigned: 
  • your (Ethernet adapter) Local Area Connection or (Wireless LAN adapter) Wireless Network Connection with your actual network IP, 
  • and the (Ethernet adapter) VirtualBox Host-Only Network which was added by the installation of VirtualBox.
It's the first IP address that we need. For an intranet, it is typically of the form 192.168.x.y or 10.0.x.y. Use this number as the website URL; a machine in your network can then get to the wiki by entering the URL
192.168.x.y/w or 10.0.x.y/w
in the address bar of a browser.
(You can close the command line window now ;-) )

Are we done?

No, we are not done. Although you do have a basic wiki up and running, there are a number of additional settings and extensions a decent wiki just can't do without. So don't start advertising your wiki to your colleagues or employees just yet...
In the next installment of the series of CoolTool articles, we'll set you up with Sphinx as your search engine back-end. This is a must-have: a wiki without a powerful search engine is not much use. And trust me, Sphinx is a powerful search engine. Ever heard of Craigslist? That's right. It's running Sphinx.