Joe's spitting in the sawdust Erlang tutorials
Tutorial number 4
Last edited 2003-11-26
Setting up a wiki

This tutorial shows you how to setup a an Erlang wiki server. All the code is in wiki.tgz.

Please, report all errors, omissions or improvements to the author.

The wiki runs as a system daemon. Setting up a system daemon was described in detail here.

Step by step instructions

  1. Down load the file wiki.tgz
  2. Create a directory to store the wiki program and data base then unpack wiki.tgz in this directory. Note: I have chosen the directory name /home/joe/installed, when you follow these instructions you will have to change this path to point to your local installation directory.

    Unpack the distribution and run make, like this:

      > mkdir /home/joe/installed
      > cp wiki.tgz /home/joe/installed
      > cd /home/joe/installed
      > tar -xzvf wiki.tgz
      > ... wiki is unpacked into a sub-directory called wiki
      > cd wiki
      > make

  3. Edit the environment variables in the start of the script . This file starts
      ## You will have to edit the following three variables
      ##   $ROOT = path to the wiki code and store
      ##   $PORT = port to run as
      ##   $ERL  = location of erlang

    Edit these environment variables to reflect the values you want on your system.

      > cd /home/joe/installed/wiki
      > emacs
      ... edit environment variables


    > cd /home/joe/installed/wiki 
    ./ debug
    Erlang (BEAM) emulator version 5.1.2 [source]
    Eshell V5.1.2  (abort with ^G)
    1> Start:{'4992','/home/joe/installed/wiki/store'}
    Starting a port server on 4992...

Fire up a web browser and surf to http://localhost:4992/wiki/.

Permanent istallation

These instructions have been tested on red hat 7.3

In the end of the file /etc/rc.d/rc.local add the following line:

    # start my local demons
    /etc/rc.d/ &

This runs the script /etc/rc.d/ in the background. Note the & is very important - running this in the foreground can be disastrous and may deadlock your system :-) is as follows:

## start my local demons

for i in /home/joe/services/*.sh 
    /bin/su joe $i start

This script is run as root. The command su joe $i start runs the shell script $i as user joe - note not as root.

The directory /home/joe/services must contain the file