An open source wiki engine which is available under the GNU General Public License.

It's used in Wikimedia projects (Wikipedia, Wiktionary, Wikisource, Wikibooks...)


Debian package

The Debian package, which is also found in Ubuntu, does some odd things to MediaWiki to fit in with the odd things Debian does to Apache.

This page tries to list those changes, for the benefit of end users coming from using a tarball.

* pkg-mediawiki-devel list at Debian


*mediawiki-distributors list

Specified versions will be maintained as long-term supported (LTS), with support from WMF and the distro packagers.

Debian changes to Apache

README.debian details much of what you need to know.

* httpd conf in /etc/apache2
* htdocs in /var/www (default)
* logs in /var/log/apache2 (default)

Sysadmins coming from using Apache tarballs should read [ this] page.

Debian changes to MediaWiki

*The package is maintained primarily with a view to being a component of [ FusionForge],<ref></ref> rather than as a standalone for people who just want to install a wiki.
*Apache rules are added in <tt>/etc/mediawiki/apache.conf</tt>
*The installer tells you to move the wiki configuration to <tt>/etc/mediawiki/LocalSettings.php</tt>
*The MediaWiki code is in <tt>/usr/share/mediawiki/</tt>, but
**<tt>LocalSettings.php</tt> and <tt>AdminSettings.php</tt> are symlinks to <tt>/etc/mediawiki/LocalSettings.php</tt> and <tt>/etc/mediawiki/AdminSettings.php</tt>
**<tt>config/</tt>, <tt>extensions/</tt>, and <tt>images/</tt> are symlinks to <tt>/var/lib/mediawiki/config/</tt>, etc.
*<tt>/var/lib/mediawiki/</tt> has <tt>config/</tt>, <tt>extensions/</tt>, and <tt>images/</tt>, along with symlinks back to <tt>/usr/share/mediawiki/includes/</tt>, <tt>/usr/share/mediawiki/index.php</tt>, etc.
*The Math extension is no longer shipped as core in upstream tarballs, and consequently not in the Debian package. It is in the <tt>mediawiki-extensions-math</tt>, and enabled with <tt>mwenext math</tt>.
*todo: mediawiki-extensions



These instructions describe the installation of a monosite wiki on a LAMP server.

After the installation, the wiki will be avalaible on :

Install mediawiki package :

# apt-get install mediawiki php5-gd php5-xcache php-pear

Uncomment the alias line in /etc/mediawiki/apache.conf :

Alias /mediawiki /var/lib/mediawiki

Restart apache and go to and fill in the form.

Copy settings in /etc/mediawiki/ and change file permissions :

# mv /var/lib/mediawiki/config/LocalSettings.php /etc/mediawiki/LocalSettings.php
# chgrp www-data /etc/mediawiki/LocalSettings.php
# chmod o= /etc/mediawiki/LocalSettings.php

You are ready to surf on your new wiki using this url:


$ apt-get install mediawiki mediawiki-math

$ a2enmod rewrite

Install mysql, and setup this apache configuration:

<VirtualHost *>
    ServerAdmin your@email

    RewriteEngine on
    RewriteRule (.*) /var/lib/mediawiki/$1

    <Directory /var/lib/mediawiki/>
        Options +FollowSymLinks
        AllowOverride All
        order allow,deny
        allow from all

    # some directories must be protected
    <Directory /var/lib/mediawiki/config>
        Options -FollowSymLinks
        AllowOverride None
    <Directory /var/lib/mediawiki/upload>
        Options -FollowSymLinks
        AllowOverride None

restart apache and go to, fill in the form, copy ?LocalSettings to /etc/mediawiki/LocalSettings.php and that's it.


changing the address to /wiki

The default address is:

but this is nicer:

To have that, change this in your apache configuration:

-    RewriteEngine on
-    RewriteRule (.*) /var/lib/mediawiki/$1
+    Alias /wiki /var/lib/mediawiki/index.php
+    Alias /index.php /var/lib/mediawiki/index.php
+    Alias /skins /var/lib/mediawiki/skins
+    Alias /images /var/lib/mediawiki/images
+    Alias / /var/lib/mediawiki/index.php

and add this to your /etc/mediawiki/LocalSettings.php:

$wgArticlePath       = "/wiki/$1";

Don't forget to clean the cache and cookies in your browser, otherwise it may look like it doesn't work for you, while it does.


There is many extensions for Mediawiki. Somes are provided by packages (mediawiki-*) but you can install other extensions in /var/lib/mediawiki/extensions/

To activate an extension, create a php script in /etc/mediawiki-extensions/extensions-available/ and run the command mwenext.

To disable a script, use the mwdisext command.

source code highlighting

$ apt-get install mediawiki-extensions
$ mwenext SyntaxHighlight_GeSHi.php

See man mwenext for info how it works.

When you do changes like this one, don't forget that mediawiki uses cache, so if some page still shows the old code, you need to purge the cache, for example by loading the page with "?action=purge" added to the end of its URL.

Moving mediawiki to another server (=archiving+restoring)

Setup the wiki as described above, except creating the database. Copy /etc/mediawiki/LocalSettings.php from the old server to the new server.

Setup a tunnel

$ ssh -L 3306:localhost:3306 server

Test the connection:

$ mysql -h -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 25383
Server version: 5.0.51-2 (Debian)

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> Bye

Create a database dump (read the "database_name" from /etc/mediawiki/LocalSettings.php)

$ mysqldump database_name -h -u root -p > db.sql

Create the tunnel to the other computer:

$ ssh -L 3306:localhost:3306 server2

Create the database:

$ mysql -h -u root -p
mysql> create database wikidb;
    -> ON wikidb.*
    -> TO 'wikiuser'@'localhost'
    -> IDENTIFIED BY 'some_password';
Query OK, 0 rows affected (0.01 sec)

mysql> Bye

Restore the database:

$ mysql wikidb -h -u root -p < db.sql

Copy the images from /var/lib/mediawiki/images from the old server to the new server by hand.

When the database already exists and you just want to update it, still use the command above, it will do the right thing. Another variation of the above command is

$ gunzip < wikidb.sql.gz | mysql -h -u root -ppassword wikidb





This page is under the GNU GPL2 license; parts of it were relicensed from a a text released under non-incompatible GFDL 1.2 and CC-BY-SA 3.0 licenses by its authors (mainly David Gerard).

CategoryPackaging CategoryPackageManagement CategorySoftware CategoryOfficeApplication