Do you use let's encrypt?

5847 votes ~ 21 comments


Creating a Wiki with kwiki

Posted by Steve on Fri 16 Dec 2005 at 16:15

Tags: ,

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.

Wikis have become familiar to many people thanks to the popularity of large sites such as Wikipedia and can be very useful for creating collaborative websites.

Whilst there are many Wiki packages included in the Debian GNU/Linux distribution I've always had a soft spot for KWiki due to its simplicity, Perl nature, and low requirements.

Installing the software under Debian is very simple and we will show how to setup a new installation using the Debian Apache2 webserver package.

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.

(Yes the hostname for this machine is Wiki, it is a virtual installation of Debian Sarge running on Xen :)

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.

Advanced customization is possible by overriding/replacing the classes which are used for the implementation of the site, but that is beyond the scope of this introduction. (There are several existing plugins listed upon the KWiki homepage which you can study if you're interested in creating your own customizations.)
Posted by ptecza (83.31.xx.xx) on Sat 17 Dec 2005 at 09:37
Hi Steve!

What about site? Is it dead?
I don't remeber any news about it. I can't also find it.

$ host does not exist, try again

Best regards!


[ Parent | Reply to this comment ]

Posted by Steve (82.41.xx.xx) on Sat 17 Dec 2005 at 11:41
[ View Steve's Scratchpad | View Weblogs ]

Ooh well remembered! I removed it due to lack of interest.


[ Parent | Reply to this comment ]

Posted by ptecza (83.31.xx.xx) on Sun 18 Dec 2005 at 18:20
Thanks for your reply! It's a sad news.

The Google cache says that site was powered by DokuWiki. Now you have written an article about kwiki. The both are Perl wikis. Which of them do you prefer? Why?

BTW, I didn't receive a notification that you replied to my comment. Did you also remove this feature? ;)


[ Parent | Reply to this comment ]

Posted by Steve (82.41.xx.xx) on Sun 18 Dec 2005 at 20:30
[ View Steve's Scratchpad | View Weblogs ]

I much prefer the KWiki installation as it is very simple to setup, and is simpler to understand in terms of coding.

Dokuwiki looked more impressive for visitors, but that was outweighed by the harder installation process and bigger code size.

(As for the comment notification; software bug. Again. I think it is fixed now.)


[ Parent | Reply to this comment ]

Posted by ptecza (193.0.xx.xx) on Mon 19 Dec 2005 at 12:04
Thank you very much for your time! I'll try kwiki :)

Have a nice day!


PS. The comment notificaton runs again :)

[ Parent | Reply to this comment ]

Posted by Anonymous (199.244.xx.xx) on Tue 20 Dec 2005 at 14:09
DokuWiki is PHP based.

[ Parent | Reply to this comment ]

Posted by ptecza (83.31.xx.xx) on Tue 20 Dec 2005 at 20:12
Hello Mr. Anonymous! :)

You're absolutely right. It's my mistake, of course. I thought that DokuWiki is Perl based, because I know that Steve rather prefers Perl than PHP :)



[ Parent | Reply to this comment ]

Posted by Steve (82.41.xx.xx) on Tue 20 Dec 2005 at 20:28
[ View Steve's Scratchpad | View Weblogs ]

Doesn't everybody? ;)

Although to be fair DokuWiki is very nice to look at and has a much better interface - the fact that it is PHP is a mark against it.


[ Parent | Reply to this comment ]

Re: Creating a Wiki with kwiki
Posted by JohnMG (204.17.xx.xx) on Mon 19 Dec 2005 at 22:56
Recently I spent some time looking for a wiki which meets these requirements:

- Simple
- Perl-based
- Easy to install
- Easy to admin
- Easy to use
- Looks good even with a text-based browser (like lynx/links/elinks)

I didn't try kwiki, but read about it and took a quick look at the source code. I was disappointed at the lack of comments in the code (it's quite dense code also). Here's a wikipedia page on kwiki:

After using PwWiki for a while (which is pretty nice, but more than I need -- also, instead of php, I wanted something in Perl to make it easier for me to configure/patch/whatever) I came across UseModWiki ( ) which I've happily been using ever since.

I highly recommend UseModWiki.

[ Parent | Reply to this comment ]

Re: Creating a Wiki with kwiki
Posted by JohnMG (204.17.xx.xx) on Mon 19 Dec 2005 at 22:59
Whoops. That link should be . BTW, thanks for the great article Steve. :)

[ Parent | Reply to this comment ]

Re: Creating a Wiki with kwiki
Posted by Anonymous (61.95.xx.xx) on Wed 21 Dec 2005 at 09:02
That is a really good article on Kwiki, although a lot more could have been added to it. I used UseModWiki at the beginning, but now switched over to Kwiki. Both are perl based, but I feel the second one easy to configure. Most of my friends using DokoWiki say that it is more featuristic than Kwiki. But I like programming in perl than PHP. Can anyone tell me some feature which will be better when the wiki is powered by Dokowiki than when it is powered by Kwiki?

[ Parent | Reply to this comment ]

no web site
Posted by rdunne (147.252.xx.xx) on Tue 3 Oct 2006 at 13:25
[ View Weblogs ]
i have done this step by step
but i get no web site , just this:
#!/usr/bin/perl -w
use lib '.';
# use lib '../lib';
use CGI::Kwiki;

when i click on htdocs

mod perl and cgid inmods enabled..
what am i not doing!!!

[ Parent | Reply to this comment ]

Re: Creating a Wiki with kwiki
Posted by Anonymous (208.49.xx.xx) on Thu 29 Oct 2009 at 18:48
I found this article very handy. Only a few things in this article are out of date as regards the current debian package of kwiki. So what I needed to know that was not in this article, is contained below:

Steps I followed:
1. install package (apt-get)

2. modify /etc/apache2/ports.conf to add a port to listen on. (Listen 8080 in my case)

3. modify /etc/apache2/sites-enabled/000default file content, which was:
<VirtualHost *:8080>
DocumentRoot /var/wiki/path/here/htdocs/
ServerAdmin webmaster@localhost
AddHandler cgi-script .cgi
DirectoryIndex index.cgi
<Directory />
# Options -Indexes
Options +ExecCGI
order allow,deny
allow from all
ErrorLog /var/wiki/path/here/log/wiki-error.log
CustomLog /var/wiki/path/here/log/wiki-access.log combined

Now restart apache, goes without saying, for most users:
sudo /etc/init.d/apache2 restart

4. create wiki as shown above, except I had to use "kwiki -new <path>" to create the wiki.

5. modify config.yaml to setup the script and rss options:
my /var/wiki/path/here/htdocs/config.yaml contains:

logo_image: mylogo.png
rss_link: http://myservername:8080/
script_name: http://myservername:8080/

Anyways, couldn't find all this out there in one place, so here it is as a blog comment. :-)

charanga dot geo at yahoo dot com.

[ Parent | Reply to this comment ]