Wikis are simple interactive websites which are extremely easy to use for storing easily updated text content. Using a Wiki you can easily create a lot of content with hyperlinks between them. Debian has packaged several different Wiki systems and here we’ll look at installing just one of them: KWiki.

To get started you’ll need to install the software:

wiki:~# apt-get install kwiki
Reading Package Lists... Done
Building Dependency Tree... Done
The following extra packages will be installed:
  perl perl-modules
Suggested packages:
  libterm-readline-gnu-perl libterm-readline-perl-perl
Recommended packages:
The following NEW packages will be installed:
  kwiki perl perl-modules
0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
Need to get 5527kB of archives.
After unpacking 22.6MB of additional disk space will be used.

Assuming that you already have an Apache2 server setup the next thing to do is configure the server to run the wiki. This is a three-step process of:

  • Creating the virtual host.
  • Enabling the execution of CGI scripts.
  • Installing an instance of the Wiki software.

Creating the virtual host should be a simple matter of adding a file into the /etc/apache2/sites-available directory specifying the details of your Wiki installation.

I host my websites beneath the /home/www directories so I create directories for the files, and for the logs with these two commands:

wiki:~# mkdir -p /home/www/
wiki:~# mkdir -p /home/www/

(Sensible administrators will almost certainly ensure that the logfiles end up in a dedicated logging partition; but that is an issue I’m not going to consider here.)

Now that these directories have been setup we can create the matching Apache configuration file /etc/apache/sites-available/

<VirtualHost *>
        DocumentRoot /home/www/
	ServerName   wiki

        # To use CGI scripts outside /cgi-bin/:
        AddHandler cgi-script .cgi

	# Our site runs via one single .cgi file.
        DirectoryIndex kwiki.cgi

	# Document root.
        <Directory />
                Options -Indexes
		Options +ExecCGI

	# Logfiles
        ErrorLog  /home/www/
	CustomLog /home/www/ combined

With this site created we enable it by running:

wiki:~# a2ensite
Site installed; run /etc/init.d/apache2 reload to enable.

(See the previous article maintaining Apache2 sites and modules lists for more details on the Debian-specific a2ensite and a2enmod tools.)

After enabling the site we need to make sure that Apache will execute our CGI scripts. We do that by enabling the mod_cgi module with the command:

wiki:~# a2enmod cgi

Now Apache is all setup, so we can now actually install an instance of the Wiki. The Debian KWiki package comes with a script which sets up a new wiki instance, allowing you to run multiple installations upon a single host. The script is called kwiki-install.

We can use it as follows:

wiki:~# cd /home/www/
wiki:/home/www/ ls
wiki:/home/www/ kwiki-install
Kwiki software installed! Point your browser at this location.
wiki:/home/www/ ls
admin.cgi  config.yaml  database   javascript  metabase   template
blog.cgi   css          index.cgi  kwiki.cgi   pages.cgi

Now that the CGI script has been installed we can load it in our browser:


(I have this hostname setup in DNS so it resolves to the IP address of the Apache server.)

In order for your visitors to be able to actually modify the page contents you must allow the Apache process to write to the various files within the installation.

The simplest way to do that is to run:

wiki:~# cd /home/www/
wiki:/home/www/ chgrp -R www-data database/ metabase/
wiki:/home/www/ chmod +s database/ metabase/

Once you’ve done that you, and your visitors, may be able to edit the text of any page. The pages themselves are stored beneath the database/directory – with the editing information stored beneath metabase/metadata/ directory.

To erase some of the “foreign” pages installed by default you could run:

wiki:~# rm /home/www/*
wiki:~# rm /home/www/*

This will just leave you with the basic (English) help files, and sample contents.

Basic configuration of the site may be conducted by editting the installed file config.yaml, this allows you to setup the sites name and other similar things.


Post By Editor (2,827 Posts)

Website: →