Manual:Running MediaWiki on Debian or Ubuntu

This guide is to help other users install WikiMedia on an Ubuntu server installation. 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).

Gather the required software
Download the latest server version of Ubuntu Linux from http://www.ubuntu.com in ISO format

Install Ubuntu
Burn the downloaded ISO image for Ubuntu to a CD and boot your target PC with it. This may required adjusting the BIOS setup to permit booting from a CD.

The setup is really very simple and self-explanatory. The only critical step is when presented with the initial Ubuntu servers installation menu, choose to install a LAMP Server.

Finish the installation procedure.

Reboot the server and sign in

Get Ubunutu Up-to-date
From the prompt, type the following commands... This will update the installation to the latest versions. Sort of like a service pack for Windows.

sudo apt-get update sudo apt-get upgrade

Once that has finished issue the following command

sudo reboot

Once the server has restarted and you have logged in again, issue another command upgrade to make sure everything is complete.

sudo apt-get upgrade

This last install will allow you to run PHP applications from the command line and is optional, but recommended:

sudo apt-get install php5-cli

Configure MySQL
Most of all, you need to apply 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: you will need this userid (root) and password when you configure MediaWiki.

Configure PHP
''These steps are simply based on experience. You can skip them entirely (or do them much later)''

Next, you need to make sure your php configuration file is configured...

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

Maximum Uploadable 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
Page down to about 21%, and change the following entry...

memory_limit = 8M to at least 20M.

Extensions
Page down a bit further (about 48%) and uncomment the following lines...

extension=mysql.so extension=gd.so

Save and exit out of the VI editor and issue a reboot to Apache...

sudo apache2ctl restart

Get Latest MediaWiki
Next we need to get the latest MediaWiki software from MediaWiki SourceForge page. View this page and note the current version number (currently, 1.9.3). Type the following commands (replace 1.9.3 with the version to download)...

cd /var/www sudo wget http://prdownloads.sourceforge.net/wikipedia/mediawiki-1.9.3.tar.gz

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

sudo tar vxfz mediawiki-1.9.3.tar.gz

rename the extracted directory name to wiki

sudo mv mediawiki-1.9.3 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://server_ip_address/wiki and continue with the installation. If you don't know your IP address, type the following...

ifconfig and look for the "inet addr" (usually second or third line down)

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 vi /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:

$wgFileExtensions = array('pdf','png','jpg','jpeg','ogg','doc','xls','ppt','mp3','sxc','pdf','nse');

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

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

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": $wgUseImageResize = true; $wgUseImageMagick = true; $wgImageMagickConvertCommand = "/usr/bin/convert"; The ImageMagick package must also be installed: sudo apt-get install imagemagick

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.

$wgLogo = "$wgScriptPath/wiki.jpg";