Manual:Running MediaWiki on Debian or Ubuntu

This guide is to help other users install MediaWiki on an Ubuntu server installation using primarily Terminal commands. Some PC knowledge is required (ie: installing applications), a bit about Operating Systems, and use of the editor vi (see vi in 10 minutes to get started).

To install MediaWiki on an Ubuntu Desktop Edition primarily via the Gnome Desktop and Synaptic Package Manager, see this page.

Step-By-Step
Ubuntu server edition comes with Apache, PHP, and MySQL installed and configured. During the installation step, make sure you choose to install a LAMP server. Alternately, you can install all four of these packages from the a normal Ubuntu installation using these commands:

sudo aptitude install apache2 sudo aptitude install mysql sudo aptitude install php5 sudo aptitude install php5-mysql

Also double check that Ubuntu is up-to-date by running:

sudo aptitude update sudo aptitude upgrade sudo aptitude dist-upgrade

If you want to run PHP commands from the command line which is useful for debugging and running maintainence scripts, install PHP-cli like this:

sudo aptitude install php5-cli

Configure MySQL
First, set up a mysql root password. Remember not to use same password for system root and mysql root. This will also clear your command history so that other users cannot get to your password...

mysqladmin -u root password "" history -c

Note: Remember this user (root) and password because you will need them when you configure MediaWiki.

Configure PHP
''These steps are optional. You can skip them entirely (or do them later) and MediaWiki should still work.''

Edit your php configuration file. It will be located somewhere like  or

sudo gedit /etc/php5/apache2/php.ini

Maximum Upload Filesize
Assuming that various files are going to be uploaded to the Wiki as content, the limit on the maximum size of an upload has to be adjusted. About one-half way down is the File Uploads section. Change: upload_max_filesize = 2M to at least 8M. You may have to adjust this again in the future.

Memory Limit
Some PHP scripts require alot of memory to run. To increase the maximum amount of memory a script can use, page down to about 21%, and change the following entry, if found, from memory_limit = 8M to memory_limit = 12M If it is already 12M or more, leave it as is.

Extensions
PHP MySQL support has to be enabled. Page down a bit further (about 48%) and make sure the following line is uncommented: extension=mysql.so

If you use the GD graphics library to do image resizing (instead of ImageMagick), also uncomment: extension=gd.so

Save and exit out of the editor and restart Apache: sudo apache2ctl restart

Get Latest MediaWiki
There is no apt package for MediaWiki so you'll have to download MediaWiki manually.

Next we need to get the latest MediaWiki software from http://download.wikimedia.org/mediawiki/. View this page and note the current version number (currently, ).

Type the following commands (replace 1.11.0 with the version to download)...

cd /var/www sudo wget http://download.wikimedia.org/mediawiki/1.11/mediawiki-1.11.0.tar.gz

Once downloaded, we need to extract the files...

sudo tar vxfz mediawiki-1.11.0.tar.gz

rename the extracted directory name to wiki

sudo mv mediawiki-1.11.0 wiki

In order to configure the wiki you have to make the config subdirectory writable by the web server.

cd /var/www/wiki sudo chmod a+w config

Configure MediaWiki
Navigate your browser to http://localhost/wiki and continue with the installation.

Pay good attention for "Checking environment..." in MediaWiki installation script. This can solve a lot of problems for your MediaWiki successful installation. Fill out the configuration form and continue.

Once configuration is done you'll need to move the created LocalSettings.php to the parent directory. For added safety you can then remove the config subdirectory entirely.

cd /var/www/wiki/config/ sudo mv LocalSettings.php .. cd .. sudo rm -rf config

And navigate your browser to http://server_ip_address/wiki to see your new wiki.

Done! You now have a working Wiki!!

Additional Wiki Configuration
The Wiki is configured by the LocalSettings.php file, usually found in /var/www/wiki. Manual:LocalSettings.php has detailed information that may be useful. The following are changes that appear to be universally helpful

To edit LocalSettings.php use sudo gedit /var/www/wiki/LocalSettings.php

Enable Uploads
By default, the Wiki will not permit images to be uploaded. To change this find $wgEnableUploads and change it from false to true.

Specifying Uploadable Filetypes
You may want to modify the list of accepted extensions, which is stored within the $wgFileExtensions array. By default you will not be able to upload PDF files, for example, without making this change.

If $wgFileExtensions is not already in LocalSettings.php add it at the end (before the ?> line, if one exists in your LocalSettings.php file):

Images Uploads
The images directory must be writeable: sudo chmod a+w /var/www/wiki/images

Enable Thumbnails
The |thumb option added to an image: tag will automatically generate a thumbnail version of a picture - if support has been enabled, as follows:

sudo aptitude install imagemagick
 * The ImageMagick package must be installed:


 * In LocalSettings.php, make sure the following settings are in place and not commented out. They are normally about 80 lines down in the file marked "To enable image uploads":

Changing The Logo
The $wgLogo variable specifies the the graphical logo that gets displayed on the top left corner by default. The variable $wgScriptPath contains the top directory of the wiki - in this case /var/www/wiki. The logo image is supposed to be 135x135 pixels; if it is oversized it will show the top left corner that fits.