Installing MediaWiki Guide: Difference between revisions

From Elvanör's Technical Wiki
Jump to navigation Jump to search
No edit summary
Line 72: Line 72:


* [http://meta.wikimedia.org/wiki/Help:Images_and_other_uploaded_files A guide for image placement and edition ]
* [http://meta.wikimedia.org/wiki/Help:Images_and_other_uploaded_files A guide for image placement and edition ]
== Customization with styles / CSS ==
* [http://meta.wikimedia.org/wiki/Skins Link to the official skins tutorial]
* There is a site wide CSS style page, accessible at [[MediaWiki:Common.css]]. There is also a corresponding page for each user. Note that this CSS page can be modified directly, this is very nice. Of course you could also edit directly the CSS files present in the software distribution of MediaWiki.

Revision as of 13:56, 20 April 2007

MediaWiki, the Wiki engine powering this site, is fully open-source and free. It seems to be robust, and reasonably fast. Configuring and installing it, however, is not so easy. This guide is a tutorial for MediaWiki administrators.


Prerequisites

  • Apache
  • PHP
  • MySQL with InnoDB support! The tables created by MediaWiki will use the InnoDB engine. I don't think it is possible to use MyISAM tables.

Optional Software

  • APC. This is a PHP accelerator.
  • memcached. This a daemon caching SQL requests in memory. If you run two Wikis on the same machine, beware that it can cause serious problems. If there is a single memcached daemon running, and both Wikis use it, they will interfere and one Wiki will end up serving the contents of the other. A solution can be to run memcached on several machines, or maybe on the same machine but with different ports. However, this last option on Mac OS X seems to be tricky.
  • ImageMagick, in order to generate the images thumbnails. This can also be done via PHP if GD support is included; however ImageMagick is recommended since it produces better quality thumbnails.

Installation

  • Installation is easy, just download MediaWiki from Sourceforge and uncompress the tarball in a directory that Apache can serve. Then follow the instructions on the README to perform the initial configuration. It involves running a PHP script that will configure the Wiki for you.
  • Warning: the initial administrator account is named "WikiSysop", and is case sensitive. If you forget it, search it on the MySQL database directly.
  • It is also recommended to increase your PHP memory_limit variable in php.ini. Else sometimes MediaWiki will fail with a message such as:
Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 80629 bytes) in /var/www/wikistuff/includes/Parser.php on line 206

I set this variable to 30 MB.

Configuration

  • Using memcached
  • Obtaining nice URLs: A guide to remove "index.php" from the URL is available online. However I don't find it very clear. The important steps are:
    • Unpack the MediaWiki in a directory NOT named "wiki", for example "wikistuff" will do.
    • In LocalSettings.php, set $wgScriptPath = "/wikistuff"; and $wgArticlePath = "/wiki/$1";
    • Write an Alias rule for Apache: add the line
Alias /wiki /filesystem/path/to/wikistuff/index.php

in the Apache configuration file. Note: don't add the second line as mentionned in the guide!

  • Disabling automatic account creation and anonymous edits. Add the following lines to LocalSettings.php:
$wgGroupPermissions['*']['edit'] = false;
$wgGroupPermissions['*']['createaccount'] = false;
  • Disabling anonymous reading. Add the following lines to LocalSettings.php:
# Pages anonymous (not-logged-in) users may see
$wgWhitelistRead = array( "Main Page", "Special:Userlogin", "-", "MediaWiki:Monobook.css" );

$wgGroupPermissions['*']['read'] = false;
  • Customizing logo (note that it should start with the name of the wiki directory, eg /wiki here):
$wgLogo = "/wiki/path/to/logo.png";
  • Allowing images uploads (set $wgUseImageMagick to false if you want to use GD instead of ImageMagick to create the thumbnails):
$wgEnableUploads = true;
$wgUseImageResize = true;
$wgUseImageMagick = true;
$wgImageMagickConvertCommand = "/usr/bin/convert";

Administration

  • Deleting/removing an user is not possible with MediaWiki. You can, however, change the password with the following SQL request:
UPDATE user SET user_password = MD5(CONCAT(user_id, '-', 
  MD5('somepass'))) WHERE user_name = 'someuser';

Usage

Customization with styles / CSS

  • Link to the official skins tutorial
  • There is a site wide CSS style page, accessible at MediaWiki:Common.css. There is also a corresponding page for each user. Note that this CSS page can be modified directly, this is very nice. Of course you could also edit directly the CSS files present in the software distribution of MediaWiki.