CategoryProposedDeletion - shouldn't this information be in README.Debian in the mediawiki package? Perhaps it should be in the Debian README file, but what is wrong with having it here as well? -- Jeremiah

An open source wiki engine which is is available under the GNU General Public License and developed on ?SourceForge via CVS.

It's used in ?WikiMedia Foundation projects (?WikiPedia, Wiktionary, Wikisource, Wikibooks....)




This 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.


For replacing the default editor by FCKeditor, you must :

  1. Download FCKeditor for mediawiki Mediawiki FCKeditor extensions

  2. Unzip the archive and copy files in /var/lib/mediawiki/extensions/
  3. Create the following script FCKeditor.php in /etc/mediawiki-extensions/extensions-available/

  1. Enable the extension

# mwenext FCKeditor.php

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