Manual:Installing MediaWiki on Ubuntu 10.04

This page describes how to get MediaWiki up and running on Ubuntu Desktop Edition, versions 10.04 (Lucid) and 10.10 (Maverick), using packages provided by Ubuntu.

As of November 2010, the latest version of MediaWiki in the Ubuntu repository is 1.15.5.

Install packages
GUI


 * 1) Menu: Applications &rarr; Ubuntu Software Center
 * 2) Search for Mediawiki in the top right search box
 * 3) Select the item "mediawiki" - website engine for collaborative work
 * 4) Click Install and enter your password if required
 * 5) Wait for packages to install. You can view the status by clicking on the In Progress sidebar item
 * 6) Choose and enter the root password for MySQL (the database), if prompted

Command line

sudo apt-get install apache2 mysql-server php5 php5-mysql mediawiki

(mysql installation will ask you to create a mysql root-user password)

If you want other extensions, like image thumbnails or APC caching, it's good to do them now before setting up Mediawiki:

sudo apt-get install php-apc imagemagick

Set URL alias of MediaWiki and server name for Apache
This section assumes you want your wiki's URL to be  http://localhost/mediawiki . If this is not what you want, change "localhost" to your preferred server name and "mediawiki" to your preferred URL alias in the following instructions.

First we have to set the server name for your new Apache server.


 * 1) Run in Terminal:
 * sudo gedit /etc/apache2/httpd.conf
 * 1) This file is empty by default. Add the following line:
 * ServerName localhost
 * 1) Save and close file.

(more here)

Next you have to set the URL alias of the MediaWiki installation.


 * 1) Menu: Applications &rarr; Accessories &rarr; Terminal
 * 2) Run the following command to open Apache configuration file:
 * sudo gedit /etc/mediawiki/apache.conf
 * 1) Remove the '#' on the third line so that line reads:
 * Alias /mediawiki /var/lib/mediawiki

(You can replace /mediawiki with any alias you want, such as /mywiki)

Restart Apache service
Apache has to be restarted to read the changed configuration files.

Run in Terminal: sudo /etc/init.d/apache2 restart

Or from Gnome Desktop GUI:
 * 1) Menu: System &rarr; Administration &rarr; Services
 * 2) Uncheck and re-check the checkbox next to Web server (Apache2)

Configure your wiki

 * 1) Open web browser and navigate to: http://localhost/mediawiki (if you changed the server name or URL alias in previous section, change the URL accordingly)
 * 2) Click " set up the wiki " link.
 * 3) For "Wiki name", you can choose any name (but not "MediaWiki") unless this installation is for a pre-existing MediaWiki instance, in which case use the same 'Wiki name' as the previous installation.
 * 4) "Contact e-mail", "Language", "Copyright/license", "Admin username" can be left unchanged.
 * 5) You will have to enter a password for the wiki administrator (default username 'WikiSysop'), and enter it again to confirm.
 * 6) "Shared memory cacheing", "Memcached servers": leave unchanged.
 * 7) "E-mail features (global)" - set to "Disabled" unless you plan to use MediaWiki's e-mail features.
 * 8) "User-to-user e-mail", "E-mail notification about changes", "E-mail address authentication", "Database type", "Database host": leave unchanged.
 * 9) "Database name", "DB username": leave unchanged to allow MediaWiki to create a user for accessing the wiki database, unless you have already used MySQL Administrator to create a database and user for MediaWiki.
 * 10) "DB password", "DB password confirm": Enter password for the wiki database user twice. Warning: This password will be stored in plain text in LocalSettings.php!
 * 11) To let MediaWiki create the wiki database and database user, click the "Use superuser account" checkbox and enter the MySQL superuser name and password.
 * 12) Click 'Install MediaWiki!' button.

Move LocalSettings.php
Run in Terminal: sudo mv /var/lib/mediawiki/config/LocalSettings.php /etc/mediawiki/

Short URL
You can make 'shorter' URLs (so that blah.com/mediawiki/index.php/Main becomes blah.com/wiki/Main ) by editing the mediawiki and apache config files.

First, let us consider /etc/mediawiki/LocalSettings.php On ubuntu 10 this file should already have a line like '$wgScriptPath = "/mediawiki";' To make the urls shorter, add these two lines:

$wgArticlePath = "/wiki/$1"; # what the url will look like for visitors $wgUsePathInfo = true;       # enable shorter url feature

Now you can edit the apache config file ( /etc/apache2/apache2.conf or if you use vhosts, something else). Add the following 2 lines:

AcceptPathInfo On Alias /wiki /usr/share/mediawiki/index.php

Now restart apache (apache2ctl restart) and you should be able to see the shorter URLs in action.

Please see Manual:Short_URL for more information.