HOWTOlabs MediaWiki
Setup, Backup, Upgrading, Tuning

MediaWiki is a very popular Wiki engine. Wiki's are online web pages that are editable directly by the viewing them in a web browser.

Initial Setup

First carve out a URL that you want to serve a wiki from. For example: and make sure Apache and DNS are handling it properly.
$ rcsdiff /etc/httpd/conf/httpd.conf 

  > <VirtualHost *:80>
  >     DocumentRoot /public/oldquad/wiki
  >     ServerName
  > </VirtualHost>

$ dig +short

$ cd /public/oldquad

$ tar xvzf /public/installers/mediawiki-1.7.1.tar.gz

$ mv mediawiki-1.7.1 wiki
Now make sure you have MySQL installed, and the PHP MySQL packages as well. You need to know the MySQL admin username and password so that database tables can be added for the Wiki.

# mysql -u root -p

> use mysql

> mysql> SELECT * FROM `user` WHERE user = 'root';

  +------------------+------+------------------+-------------+-------------+-------------+-------------+- ... -+
  | Host             | User | Password         | Select_priv | Insert_priv | Update_priv | Delete_priv |       |
  +------------------+------+------------------+-------------+-------------+-------------+-------------+- ... -+
  | localhost        | root | 0cbd366c6353a01f | Y           | Y           | Y           | Y           |       |
  | | root | 0cbd366c6353a01f | Y           | Y           | Y           | Y           |       |
  +------------------+------+------------------+-------------+-------------+-------------+-------------+- ... -+
Now use a web browser to bring up the initial wiki setup page. Note, make sure the config directory is world writable for this step.
$ cd /public/oldquad/wiki

$ ls -ld config

  drwxr-sr-x  2 fredness oldquad 4096 Jul  8 22:45 config

$ chmod 777 config
Now, check out the fat Wiki Installation page! Calm down. Many of the settings can be left at the already provided default values. Here's an example listing minimum fields that need values. Of course you will use slightly different values. This is meant to help illustrate what needs to be entered.
Wiki name: OldQuad
Admin username: WikiSysop
Password: ******
Database type: MySQL
Database host: localhost
Database name: wikioq
DB username: wikioq
DB password: ******
Superuser account: root
Superuser password: ********  (this should be known already)

  Install MediaWiki!
  [ can take over a minute? ]

Getting close. See the instructions at the bottom of the post-Installation page. A LocalSettings.php file has been generated, but now needs to be moved into the main Wiki directory. Do this using the command line.
$ pwd


$ mv config/LocalSettings.php .


First, make sure you know the MySQL 'user account' username and password that your wiki is using. The LocalSettings.php file from you existing wiki should have these values already (wiki won't run without them).
The following shows how to confirm wiki database user access and basic backup commands.
# mysql -u wiki -p

mysql> use wikidb

mysql> show tables

mysql> \q

# cp -a /var/www/html/wiki [backupfiles]

# mysqldump wikidb -u wiki -p --skip-opt > [dbbackupfile]


If this is an upgrade, rename your old wiki dirctory.

Place the the latest wiki applicaiton file set in directory with name that was used for you wiki.

If this is fresh system, you need to add the MySQL user account if it is not already present.

This will show basic means for recreating Mysql user account, adopt this to add wiki user account
# mysqldump mysql user
If this is fresh system, you need to also import the MySQL database if it is not already present.
# mysql scalixwiki -u wiki -p  < /public/archive/wiki-20060912-daily2.sql
Create a AdminSettings.php file by adopting it from AdminSettings.sample file.
# rcsdiff AdminSettings.php

  diff -r1.1 AdminSettings.php
  < $wgDBadminuser      = 'wikiadmin';
  < $wgDBadminpassword  = 'adminpass';
  > $wgDBadminuser      = 'wiki';
  > $wgDBadminpassword  = 'xilacs';
Make sure php-mysql package is installed
yum install php-mysql
Make sure to copy over your LocalSettings.php file. If this is a new conifuration, may need to adjust LocalSettings.php $IP = include path.
[root@morpheus wiki]# diff ../wiki-old/LocalSettings.php LocalSettings.php
< $IP = "/var/www/html/";
> $IP = "/var/www/html/wiki";
[root@morpheus maintenance]# php update.php
A copy of your installation's LocalSettings.php
must exist in the source directory.
[root@morpheus maintenance]# pwd
[root@morpheus maintenance]#
Note: LocalSettings.php may morph slightly from one version to another. May be worth setting up scratch pad of net wiki and comparing the default Locasettings it creates ofr a new wiki vs the one you are usign from you last wiki.


As of MediaWIki 1.7.X, PHP 5.X is required or install/upgrade errors ensue :-(

# php update.php

  PHP Parse error:  parse error, unexpected T_STRING,
  expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}'
  in /var/www/html/wiki/includes/Exception.php on line 114
  Content-type: text/html
  X-Powered-By: PHP/4.3.9

2009, fredness

Disabling Anonymous Edits

Related [ edit ]
$ rcsdiff LocalSettings.php

  > # The following lines set permissions so that wiki page can only be edited by
  > # registered and logged in users
  > # Added by Nick Atkins - 01/06/06
  > $wgGroupPermissions['*'    ]['createaccount']   = true;
  > $wgGroupPermissions['*'    ]['read']            = true;
  > $wgGroupPermissions['*'    ]['edit']            = false; 
The above is for MidiaWiki 1.5 and later. Note, setting createaccount = false will prevent anonymous users from creating accounts for themsleves.

Sysop Users

Users with SysOp priviledges have additional special pages they can view, and normal pages will include a delete tab.  Which accounts have SysOp access is controlled by editing/adding records in the Wiki's mw_user_groups table.