Sunday, 27 April 2008

Installing and Configuring Mediawiki on a Ubuntu Gutsy Desktop System

Mediawiki is the web based tool (wiki software) that Wikipedia uses to manage, store and serve its contents.

Mediawiki is written in PHP, and in this installation we will use MySQL as database management system (although it can be configured to use PostgreSQL)

Mediawiki is ditributed under the GNU GPL license.


INSTALLING MEDIAWIKI


First step is installing MySQL:
$sudo aptitude install mysql-admin mysql-server

It will ask you for MySQL root password. Then choose a secure password and type it.


Now we install Mediawiki itself:
$sudo aptitude install mediawiki

It will automatically check for apache and php dependencies.

Current mediawiki version is 1.10.


At installation I get this warning:
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName

There is some info in this thread at ubuntu forums.

To get rid of the error:
$gksudo gedit /etc/apache2/httpd.conf

httpd.conf file is usually empty, and then we add this line:
ServerName localhost

After saving the file we check if the error is gone executing this command:
$sudo apache2ctl restart


SETTING MEDIAWIKI URL ALIAS


Open apache.conf file:
$gksudo gedit /etc/mediawiki1.10/apache.conf

Uncomment this line:
#Alias /mediawiki /var/lib/mediawiki1.10

You can change /mediawiki to whatever you wanna the wiki be named. e.g: /myWiki

Restart the apache server with:
$sudo apache2ctl restart
or
$sudo /etc/init.d/apache2 restart


Now you can navigate into your wiki:
http://localhost/mediawiki


There will appear a page with a link saying: "Please set up the wiki first."

It is okey. We click on the link so entering within the wiki configuration page: http://localhost/mediawiki/config/index.php


SETTING UP THE WIKI FOR THE FIRST TIME


We are at the configuration page: http://localhost/mediawiki/config/index.php and we assign adequated values for:

Wiki name: this name will appear at the top of your wiki pages.

e-mail, language, ...

Admin username: WikiSysop by default. This user will have all the privileges to mantain the wiki.

Admin password


I want a very simple configuration so I disable all email settings. So I won't be notified when a wiki page is changed, etc.


At database configuration part I leave the defaults:
NOTE: If you have an account and database already created, you can introduce those values here.

type: MySQL
host: localhost
name: wikidb
username: wikiuser


I choose and set a password for this database user.


As I have no previously created a user and a database and I am very lazy and want mysql root user to create them, so I check superuser account:

Superuser account: checked
Superuser name: root
Superuser password: MySQL root password.



Let's go and click: Install Mediawiki! button

We arrive to a page that says Installation successful! if everything has gone fine


Next and last step is configuring LocalSettings.php file:


CONFIGURING LocalSettings.php FILE


There is comprehensive info about configuring LocalSettings.php file at Manual:LocalSettings.php

Checking out DefaultSettings.php file may also be interesting. It can be found at:
/var/lib/mediawiki1.10/includes/DefaultSettings.php

We begin editing the file:
$gksudo gedit /var/lib/mediawiki1.10/config/LocalSettings.php


We are gonna allow file uploads to our wiki:

search this variable $wgEnableUploads at LocalSettings.php file and set it to true:
$wgEnableUploads = true


GROUP CONFIGURATION


This wiki group configuration is going to be very simple. It consists on two user types, logged ones and anonymous users.

Anonymous users will be able to navigate through the wiki but will be unable to change or edit anything.

Logged users will be capable of reading, editing, uploading files, creating new wiki pages and creating new accounts for their friends. :)

Only WikiSysop will have privileges enough to delete or rename wiki pages.


In order to obtain this configuration, we have to copy this lines at the end of LocalSettings.php file:
#Global permissions (anonymous users too)

$wgGroupPermissions['*' ]['createaccount'] = false;
$wgGroupPermissions['*' ]['read'] = true;
$wgGroupPermissions['*' ]['edit'] = false;
$wgGroupPermissions['*' ]['delete'] = false;
$wgGroupPermissions['*' ]['createpage'] = false;
$wgGroupPermissions['*' ]['upload'] = false;
$wgGroupPermissions['*' ]['move'] = false;

#Logged users

$wgGroupPermissions['user' ]['createaccount'] = true;
$wgGroupPermissions['user' ]['read'] = true;
$wgGroupPermissions['user' ]['edit'] = true;
$wgGroupPermissions['user' ]['delete'] = false;
$wgGroupPermissions['user' ]['createpage'] = true;
$wgGroupPermissions['user' ]['upload'] = true;
$wgGroupPermissions['user' ]['move'] = false;


more info at:
Manual:$wgGroupPermissions


MOVING LocalSettings.php TO /etc


Finally we place LocalSettings.php file at /etc directory with its adequate permissions.

$cd /var/lib/mediawiki1.10
$sudo chown root:www-data LocalSettings.php
$sudo mv config/LocalSettings.php /etc/mediawiki1.10/
$sudo chmod 0640 /etc/mediawiki1.10/LocalSettings.php



CREATING A NORMAL USER ACCOUNT


Our wiki setup is completed!
We type http://localhost/mediawiki at the navigator and access to the wiki.

First time, we will have to enter using WikiSysop account and create a normal user one.
To do that, once you have logged as WikiSysop, go to Special pages and then to Log in / create account

Enjoy your wiki!!


Most info comes from Mediawiki site:
Installing_MediaWiki_on_Ubuntu_7.10_via_GUI_and_Synaptic


YOU MAY ALSO BE INTERESTED IN:


Installing Mediawiki using SQLite Database in GNU/Debian

Backing and Restoring Mediawiki in Ubuntu

0 comentarios: