Mediawiki Installation

From SaruWiki
Revision as of 17:36, 27 December 2009 by Saruman! (talk | contribs) (added tricks section)
Jump to navigation Jump to search

Installation of MediaWiki

Here we have the basic installation of MediaWiki outlined for you.

The default installation will create your wiki in subdirectory /mediawiki. Should you wish to have another name, e.g. http://www.yourserver.com/wiki, then you must make two changes.

Extra configuration

After installation of MediaWiki, your Wiki is available on every Virtual Host you run - unless you follow the instructions to place MediaWiki inside a Virtual Host.

An extra feature we added was support for iFrames by means of a little PHP script that we googled; the extension is called websiteFrame.php.

Furthermore, we changed the Creative Commons picture in the footer from a remote one to a local one.

For performance, the following tricks can be used (which we found on this site):

  • apt-get install php-apc
    to install a PHP accelerator;
  • add $wgMainCacheType = CACHE_ACCEL; (instead of CACHE_NONE) into LocalSettings.php to enable that installed APC PHP accelerator;
  • add $wgDisableCounters = true; into LocalSettings.php to disable the page counters.

On the example site referenced, the cache reduced rendering of an (almost empty) main page from 217ms to 50ms; disabling the page view counter took off another 10ms.

Should you wish to customize the look of your MediaWiki wiki, then you must edit the MediaWiki skins.

Extensions

One of the nice things about using something as popular as MediaWiki is the availability of a great number of extensions. One of the first things to do, therefor, is to install the default Debian Mediawiki Extensions package.

For user management, we added the extensions Password Reset and Group Permissions Manager.

A feature we needed to gain experience for another project was the Semantic MediaWiki (SMW) extension; it also has a pretty simple installation.

Multiple Wiki's on a single server

Some people want to run multiple Wiki instances on one single server - especially so if that server runs multiple websites (the forementioned Virtual Hosts). The answer to that is to create a Wikifarm.
Note that we've set up a separate site for this problem - you're welcome there with any questions you might have on wikifarms on Debian.

User Rights management

The MediaWiki documentation quite clearly documents how to manage user rights, but here is a very quick recap:

The following user rights are granted implicitly to non-logged-in users:

// Implicit group for all visitors
$wgGroupPermissions['*'    ]['createaccount']   = true;		// 1.5.0
$wgGroupPermissions['*'    ]['read']            = true;		// 1.5.0
$wgGroupPermissions['*'    ]['edit']            = true;		// 1.5.0
$wgGroupPermissions['*'    ]['createpage']      = true;		// 1.6.0
$wgGroupPermissions['*'    ]['createtalk']      = true;		// 1.6.0

So if you want to limit the rights of anonymous users, paste these lines into LocalSettings.php and change to false those rights that you want to take away. e.g. if you do not want anonymous users to edit pages, set the 'edit' permission to false. Setting 'read' to false requires users to log in before they can read your wiki (but they can still see the sidebar!)

The following rights are implicitly granted to all logged-in users.

// Implicit group for all logged-in accounts
$wgGroupPermissions['user' ]['move']            = true;		// 1.5.0
$wgGroupPermissions['user' ]['read']            = true;		// 1.5.0
$wgGroupPermissions['user' ]['edit']            = true;		// 1.5.0
$wgGroupPermissions['user' ]['createpage']      = true;		// 1.6.0
$wgGroupPermissions['user' ]['createtalk']      = true;		// 1.6.0
$wgGroupPermissions['user' ]['upload']          = true;		// 1.5.0
$wgGroupPermissions['user' ]['reupload']        = true;		// 1.6.0
$wgGroupPermissions['user' ]['reupload-shared'] = true;		// 1.6.0
$wgGroupPermissions['user' ]['minoredit']       = true;		// 1.6.0
$wgGroupPermissions['user' ]['purge']           = true;	 	// 1.10.0

NOTE: you cannot let normal users keep a right like 'edit' and take it away for a special group that you create, like 'students'. You MUST grant the group 'user' the fewest rights that anyone should have, grant extra rights to other groups, and place the right users in these other groups. Examples:

$wgGroupPermissions['student' ]['edit']            = false; // WILL NOT WORK

The above will NOT "give everyone edit rights except for students".

$wgGroupPermissions['*'    ]['edit']            = false;		// 
$wgGroupPermissions['user' ]['edit']            = false;		// explicitly take away edit from all logged-in users
$wgGroupPermissions['staff' ]['edit']           = true;		// then give back edit to everyone except standard
$wgGroupPermissions['visitingstaff' ]['edit']   = true;		//  users

This WILL work: the edit right is taken away from everyone, including students, untill that right is explicitly restored. Just restore it to the necessary groups, taking care not to restore it to 'students'.

So if you want to grant everyone 'edit' except for a particular account - sorry, don't know how that'd work.

Other interesting tricks