MediaWiki installation

From gvSIG CE Wiki

Jump to: navigation, search

This (gvSIG CE) Wiki runs on MediaWiki, a popular open source choice. This page describes the gvSIG CE MediaWiki installation and configuration in detail.



This documentation contains a full protocol of all installation steps. This information can be used to understand and replicate the installation in case of problems. There are no passwords or other confidential information on this page. Never publish sensitive information on our Wiki!. If you wish to take over administrative tasks for gvSIG CE, contact one of our project members directly.

Command line work

Note: Please make sure to read the page on Working with Project Web first, before attempting to replicate the steps detailed here.

Go into the root directory of the web service:

 cd /home/project-web/gvsigce/htdocs

Get the MediaWiki files and unzip them:

 wget -c
 tar -xzf mediawiki-1.16.4.tar.gz

Simplify the name of the installation directory:

 mv mediawiki-1.16.4 wiki

The name of the installation directory is now simply "wiki".

Change into MediaWiki root directory:

 cd wiki

Make sure that you are now within the new MediaWiki installation directory! This director will be referred to as the MediaWiki root directory from now on.

Prepare the installation:

  chmod g+w config

Web-based configuration

Browse to:

  • Click the link that you see on the first page to "set up the wiki".
  • On the installation page that now appears, you will see a list of checks at the top. There may be some PHP problems, but the global PHP setting are controlled by SF and we cannot influence them. If there is a green line saying "Environment checked. You can install MediaWiki." then all is OK.
  • Under "Site Config", enter a name for the Wiki, and all the detail for the admin account.

Note that you need to provide email addresses, so that the SMTP daemon can later send confirmation messages. However, you can leave the email fields blank for now and set them later manually in the "LocalSettings.php" (see instructions below).

  • Under "Email", to keep email volume in check, disable at least "User-to-user email" and set "E-mail notification about changes" to "Enabled for changes to user disccusion pages only"
  • For the details of the Database config, please see the corresponding section on the Working with Project Web page. Remember to use the SF-assigned database name prefix when choosing a name for the database! Also, use a "Database table prefix", such as "mw_". Leave all other database settings to their default.
  • Click "Install MediaWiki!" and wait for the "Installation successful!" message.

Before doing anything else with the Wiki, read the following instructions on cleaning up!

Cleaning up

The installation routine will have created a configuration file LocalSettings.php. Move it to the root directory of the WikiMedia installation and adjust file permissions:

 mv config/LocalSettings.php .
 chown <username> LocalSettings.php

Then delete the entire "config" folder:

 rm config -rf

Also, allow write access to the default directory for uploads ("images"):

 chmod g+w images

Essential configuration

Note: much of this information has been taken from the MediaWIki Manual.

When the configuration is done, you will find a new file LocalSettings.php in the MediaWiki root directory. Edit it to make some important settings.

Outbound email

Add the following block to allow the Wiki to send email to its users (e.g. for registration!):

 $wgSMTP = array(
  'host'     => "prwebmail",
  'IDHost'   => "gvsigce",
  'port'     => 25,
  'auth'     => true,
  'username' => "gvsigce",
  'password' => "[SF.Net Project Web mail password]"

You also have to configure a sender address for the SMPT daemon. Use the schema <project>

 $wgEmergencyContact = "";
 $wgPasswordSender = "";


To enable uploads (e.g. images to include on Wiki pages), find the appropriate line and set:

 $wgEnableUploads       = true;

Wikimedia Tuning

This section describes how to configure a fresh WikiMedia installation to improve its visual appeal and reduce its complexity.

Unless otherwise noted, the settings described below can be found/have to be added to the file LocalSettings.php. After a successful installation of MediaWiki, this file will be located in the root folder of the MediaWiki installation.

The official instructions for configuring a MediaWiki installation are here. A full listing of configuration settings for LocalSettings.php can be found here.

Web-based administration

Some aspects of WikiMedia can be configured without having to edit configuration files (user management, etc.). This is done via so-called "Special Pages", which are available under this link:

All users also have access to their personal preferences page (email options, skins, ...):


Graphical designs ("skins") are saved in the directory skins. More information can be found here.

The site administrator can set the default skin, but users are free to choose any other skin that is part of the installation. Some freely available skins can be found here.

A particularly clean style, which is also used by the QGIS Wiki, is "Cavendish mod". The latest version as of writing these instructions was here.

To install it, just download it into "skins" and unpack it:

 cd skins
 tar -xzf cavendish-mod-0.9.tar.gz 
 cd ..

To use it as default skin for the installation, set:

 $wgDefaultSkin = 'cavendish';

You can also remove (all other) skins from the user preferences choices:

 $wgSkipSkins = array("chick", "cologneblue", "modern", "myskin", "nostalgia", "simple", "standard", "vector");

Tuning the Cavendish Mod skin

The following are some notes on adjusting the visual appearance of the Cavendish Mod skin a little. This style has beend derived from the original Wiki template.

This is done by editing the CSS style files in skins/cavendish directly. The main file is main.css, which then loads: content.css, template.css, basetemplate.css and cavendish.css for additional styling information.

The basic layout is defined in main.css. E.g. to modify how the Wiki site name is displayed in the header, edit this block:

 #header h1 a {
   /*background: transparent url("wiki_header_logo.gif") no-repeat scroll 5px -5px; */
   font-family: Ubuntu, "Trebuchet MS", Verdana, Helvetica, sans-serif;
   color: #FFFFFF;
   font-size: 1.7em;
   text-shadow: 1px 1px 2px #000;
   text-indent: 3.7em;
   /* text-transform: lowercase; */

The skin also uses the relatively new "Ubuntu" font, which is not any more readable than the classic Helvetica, but may lead to different rendering results in different browsers and needs to be downloaded from Google's servers for those users who don't have it.

This is unfortunate, but easy to revert. Edit the files skins/cavendish/main.css and skins/cavendish/cavendish.css. Search for "Ubuntu" and "Droid". Eventually, you will see the "font-family" tags that use these new fonts. There is just a handful of them. Every one of the tags has a list of possible fonts. The left-most is the prefered one. Set it to "Helvetica" instead of "Ubuntu" or "Droid".

In addition, change the "body" font definition in skins/cavendish/main.css to disable the bad default word and letter spacings (ca. line 127):

 /* General Structure */
 body {
   font-family: Helvetica, Verdana, 'Bitstream Vera Sans', 'DejaVu Sans';
 /*    font-size: 0.75em; */
   font-size: 10pt;
   word-spacing: 1.5px;
   letter-spacing: 0.5px;
   color: #000;

Menu contents

The tools and navigation menus on the left side of the Wiki are too full for most users and shy away new/beginning users. The following are some hints on how to reduce them to the bare necessities:

The "Navigation" sidebar is a basic WikiMedia commodity and can easily be edited: Basically, edit the special page "MediaWiki:Sidebar" as an administrator.

Note: Unlike other pages, the first time you open this page you have to click "Create" in order to edit it!

More details are available here.

The "Personal tools" and "Toolbox", however, are generated by PHP code that needs to be edited directly in includes/SkinTemplate.php and will affect all skins!

The "Personal tools" sidebar is generated by (ca. line 540):

 function buildPersonalUrls() {

The following are some suggestions on removing things that few users will ever need.

Comment out the block that generates the User Talk page (ca. line 561):

 $usertalkUrlDetails = $this->makeTalkUrlDetails( $this->userpage );
 $personal_urls['mytalk'] = array(
          'text' => wfMsg( 'mytalk' ),
          'href' => &$usertalkUrlDetails['href'],
          'class' => $usertalkUrlDetails['exists'] ? false : 'new',
          'active' => ( $usertalkUrlDetails['href'] == $pageurl )

In fact, you might want to comment out the entire Talk feature:

 $content_actions['talk'] = $this->tabAction(
           $this->mTitle->isTalkPage() && !$prevent_active_tabs,

The "Toolbox" sidebar, on the other hand, is a feature of the Cavendish mod skin, and is generated by skins/cavendish.php (ca. line 329):

 function toolbox() {

Again, some suggestions on how to reduce it:

Comment out the "Printable version" and "Permanent link" tools:


 if(!empty($this->data['nav_urls']['print']['href'])) { ?>
 <li id="t-print"><a href="<?php echo htmlspecialchars($this->data['nav_urls']['print']['href']) ?>" rel="alternate"<?php echo $this->skin->tooltipAndAccesskey('t-print') ?>><?php $this->msg('printableversion') ?></a></li><?php		} */
 if(!empty($this->data['nav_urls']['permalink']['href'])) { ?>
 <li id="t-permalink"><a href="<?php echo htmlspecialchars($this->data['nav_urls']['permalink']['href'])?>"<?php echo $this->skin->tooltipAndAccesskey('t-permalink') ?>><?php $this->msg('permalink') ?></a></li>
         <?php } elseif ($this->data['nav_urls']['permalink']['href'] === ) { ?>
               <li id="t-ispermalink"<?php echo $this->skin->tooltip('t-ispermalink') ?>><?php $this->msg('permalink') ?></li>

The expected size of the logo depends on the skin. Some skins don't display a logo at all.

Simply set the $wgLogo variable to point to the image file you wish to use for a logo:

 $wgLogo = "$wgStylePath/common/images/logo-128.png";

Access control and restrictions

Note: More details on how to manage user groups and access restrictions can be found here and here.

Disable talk pages for anonymous users (IPs):

 $wgDisableAnonTalk = true;

Disallow blocked users to log in:

 $wgBlockDisablesLogin = true;

Require users to confirm email address before they can edit:

 $wgEmailConfirmToEdit = true;

Allow sysops to ban logged-in users:

 $wgSysopUserBans = true;

Allow anonymous users (not logged in) to read only the Main Page and create a login account, but nothing else:

 $wgGroupPermissions['*']['read'] = true;
 $wgGroupPermissions['*']['edit'] = false;

Further tuning

Set to true to have nicer highlighted text in search results:

 $wgAdvancedSearchHighlighting = true;

Enable suggestions while typing in search boxes:

 $wgEnableMWSuggest = true;

Go button goes straight to the edit screen if the article doesn't exist:

 $wgGoToEdit = true;

SF logo display

According to the terms of usage, the SF logo has to be displayed on every web page.

A version that fits well into the footer of the Cavendish skin is this one. Download it into skins/common/images.

Then edit skins/cavendish.php to overwrite the definition of the function getPoweredBy() from include/Skin.php (ca. line 22):

 class Skincavendish extends SkinTemplate {
 	function initPage( OutputPage $out ) {
 		parent::initPage( $out );
 		$this->skinname  = 'cavendish';
 		$this->stylename = 'cavendish';
 		$this->template  = 'cavendishTemplate';
 	 * We modified the default getPoweredBy() function (include/Skin.php),
 	 * so that the logo gets displayed.
 	 * The logo has to be displayed on every page, according to the
          * terms. 
 	function getPoweredBy() {
 		global	$wgVersion;
 		global	$wgStylePath;
 		$url1 = htmlspecialchars( "$wgStylePath/common/images/sf_120x30_silver.gif" );
 		$img1 = '<a href=""><img src="' . $url1 . '" height="30" width="120" alt="Hosted by SourceForge" /></a>';
 		$url2 = htmlspecialchars( "$wgStylePath/common/images/poweredby_mediawiki_88x31.png" );
 		$img2 = '<a href=""><img src="' . $url2 . '" height="31" width="88" alt="Powered by MediaWiki" /></a>';
 		$logo = ' ' . $img1 . ' ' . $img2;
 		return $logo;