MediaWiki Installations

From TechWiki

Jump to: navigation, search

Contents

Prerequisites

MediaWiki can be customized to a great extent and it is important that one understands and has a basic idea of the various features that will be used before actually going ahead with the installation.

Hosting

Most MediaWiki features can be enabled on shared hosting just as easily as they can be on dedicated hosting. There might be slight differences in the way this is done, however the end result is nearly always similar and workable.

Quick installs

Some hosting providers such as dreamhost provide easy and pre-defined ways to install MediaWiki. Most of these "quick installs" install MediaWiki in ways that reduce its flexibility. MediaWiki is extremely easy to install and it is probably better that it is installed directly so as to familiarize oneself with the system.

MediaWiki Customizations

Its worth reiterating that MediaWiki is highly customizable. Some customizations require certain specific changes/settings during installation. Its important that one goes through the complete list of possible customizations, chooses the ones that will finally be used and then goes ahead with the installation.

Installation

The installation steps provided below assume that the wiki will eventually use Short URLs. The article regarding MediaWiki Short URLs lists the advantages of using short URLs.

Directory Structure

The actual location of your MediaWiki installation on your web server has an impact on the flexibility and functionality of MediaWiki.

Why not the root

In general its a bad idea to install MediaWiki to the root of a domain. There are many reasons for this including the possible problems that could arise when configuring robots.txt or using when apache .htaccess.

The following directory structure however is used specifically so as to enable Short URLs.

The structure that Wikipedia uses

Well that fact that Wikipedia uses this specific directory structuring does not imply that it is the best way to do it, however we can safely assume that its a tested method and since most documents on-line tend to provide examples in similar ways its probably best to use the same method.

create a directory called 'w' in your server root directory. All your wiki programs now need to be installed into this directory.

If you follow these instructions the wiki itself will be installed to your-domain.com/w/ and your wiki pages will be accessed from your-domain.com/wiki/name-of-article.

Downloading and configuring MediaWiki

Downloading MediaWiki

MediaWiki can be downloaded from here. Place the content files of the downloaded folder into the directory 'w' that you just created and point your browser to your-domain.com/w/.

commands to extract:

gunzip mediawiki-1.x.x,tar.gz
tar -xvf mediawiki-1.x.x.tar

command to copy

cp -r mediawiki-1.x.x/* w/

MediaWiki basic configuration

You will be asked to provide some details regarding the name of your Wiki and so on along with database information which we will discuss in the next section.

Database configuration for MediaWiki

This installation assumes the use of MySql. MediaWiki does not require one to customize the database to a great extent (unless of course your wiki is extremely big) and so regardless of which database you use these instructions can provided general instructions on database setup for MediaWiki.

MySql

MySQL is a multithreaded, multi-user SQL database management system which has more than 11 million installations. The program runs as a server providing multi-user access to a number of databases. details

The Choice of MySql as the database server is based on its reliability, scalability and most importantly its popularitly. (The more popular a system the easiar it is to get ones questions answered on forums).

MySql Database configuration for MediaWiki

Create a new database which we will call 'mediawiki' and choose a password for that database.

When configuring MediaWiki simply enter the database name and password into the configuration page.

Cleaning up

Once the installation and configuration is complete traverse to the 'config' directory within the MediaWiki directory and mv the file 'Localsettings.php' to the wiki root directory by use of the command:

mv Localsettings.php ../ 

For all practical purposes your MediaWiki installation is complete - but for security reasons delete the folder 'config' by traversing to the root of your MediaWiki installation directory and using the command:

rm -rf config/ 

Short URLS

now to make the wiki work of the root of your website (i.e. www.website.com instead of www.website.com/w/) do the following.

Step 1 : Edit the Localsetting.php file, add or edit the following :

$wgScriptPath = '/w';         # Path to the actual files. This should already be there
$wgArticlePath = '/wiki/$1';  # Virtual path. This directory MUST be different from the one used in $wgScriptPath
$wgUsePathInfo = true;

Step 2 : IF you have access to the httpd.conf file (in case of dedicated hosting) add the following to the httpd.conf file :

 Alias /wiki /var/www/w/index.php

ELSE edit or create the .htaccess file ( in your web root ) and add the following:

Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^wiki/(.*)$ w/index.php?title=$1 [PT,L,QSA]
RewriteRule ^wiki/*$ wiki/ [L,QSA]
RewriteRule ^/*$ wiki/ [L,QSA]
Personal tools