This is a example OpenBSD 3.9 installation of Instiki wiki using lighttpd and fastCGI as front end. The instiki wiki is used as a public web page. Instiki is a Ruby On Rails application which uses a MySQL database for persistent storage. Everything is free for non-commercial use as this is.

Many steps are included in the description below but most likely not all. Anyway this could probably be used as some guidance when trying to setup a similar server as I did.

Install OpenBSD 3.9

Install base installation (all sets) of OpenBSD 3.9.

Add user peter


Note - Invite into wheel group

Install source and ports collection

mkdir /mnt/cdrom
mount -t cd9660 -r /dev/cd0a /mnt/cdrom/
cd /usr
cp /mnt/cdrom/ports.tag.gz /usr/
tar -xzvpf ports.tar.gz
cd /usr/src
cp /mnt/cdrom/src.tag.gz /usr/src
cp /mnt/cdrom/sys.tag.gz /usr/src
tar -xzvpf src.tar.gz
tar -xzvpf sys.tar.gz

Add cdrom to fstab

Add the following line to /etc/fstab

/dev/cd0a /mnt/cdrom cd9660 ro,noauto 0 0

Add nano text editor


Add default package handling for root

Add the following lines in /root/.profile (use nano)

Package handling

Enable permissions in system control

Allow port forwarding IPv4, IPv6

Setup pf.conf

See pf.conf file for an example

Install ddclient from source

cd /usr/ports/net/ddclient
make install

Install precompiled/downloaded packages

set PKG_PATH = /mnt/cdrom/3.9/packages/i386/
pkg_add jdk-1.4.2p7.tgz
pkg_add samba-3.0.21bp2.tgz
pkg_add tcl-8.4.7p1.tgz
pkg_add expect-5.43.0p0.tgz
pkg_add tk-8.4.7.tgz
pkg_add sqlite3-3.2.8p0.tgz
pkg_add sqlite3-tcl-3.2.8p0.tgz

Add local man page

cp /mnt/cdrom/other/local.0 /usr/local/man/cat1/local.0

Install RubyOnRails

See RailsOnOpenBSD

Install Ruby, Rails

pkg_add ruby-1.8.4p1.tgz
pkg_add ruby-gems-0.8.11.tgz
pkg_add ruby-iconv-1.8.4p1.tgz
gem install rails
gem install \RedCloth

Install fastCGI

pkg_add fcgi-2.4.0p1.tgz
gem install fcgi

Install MySQL

pkg_add mysql-server-5.0.18.tgz

Install default database


Set root password

mysql -u root mysql

(press enter i.e. empty password)

mysql> SET PASSWORD FOR root@localhost=PASSWORD('pw');
mysql> exit

Add database for instiki

mysql -u root -p
<enter 'pw'>
mysql> create database instiki_test;
mysql> grant all privileges on instiki_test.* to root;
mysql> exit

Install Lighttpd

pkg_add lighttpd-1.4.10p1
mkdir /var/www/pages
mkdir /var/www/pages/rails
Edit /etc/lighttpd.conf

Install testapp

cd /var/www/pages/rails
tar xzvf testapp.tgz

Change rails version in /config/environment.rb


Restart lighttpd

pkill lighttpd
lighttpd -f /etc/lighttpd.conf

Open browser to

Install Instiki

cd /var/www/pages/rails/
cp /root/download/instiki-0.11.0.tgz .
tar xzvf instiki-0.11.0.rgz
mv instiki-0.11.0 instiki

Change first line of instiki/public/dispatch.fcgi to #!/usr/local/bin/ruby

Add the following line in to instiki/config/environment.rb

ActionController::AbstractRequest.relative_url_root = "/instiki"

Migrate database to MySQL tables

cd /var/www/pages/rails/instiki
rake migrate

Edit /instiki/config/database.yml to point to MySQL

Initialize wiki web

cd instiki (not the port that it is started on)
Go to<port>/

Wiki name: wiki
password: pw

Edit /etc/rc.local to start MySQL, lighttpd and ddclient

Transfer wiki

cd instiki
mv app app_old
cp ../instiki_klagshamn/app .
cp ../instiki_klagshamn/public/stylesheets/* public/stylesheets
cp -R ../instiki_klagshamn/public/images/static/ public/images/

Change references in /app/views/layouts/default.rhtml

<div id="Header">
<img src="/instiki/images/static/header_image.jpg">
</div> <!-- Header -->

<div align="center">
<table class="hidden_table" border="0" width="660">
<td class="hidden_table" colspan="2" vertical-align="left">
<% if @show_page_navigation %>
<div class="page_navigation" align="left">
<div class="navigation">
<a href="/instiki/wiki/show/HomePage">Hem</a> |

Restart lighttpd

pkill lighttpd
lighttpd -f /etc/lighttpd.conf

Example configuration file for lighttpd.


[[Lighttpd Log Rotation]]

Install zip/unzip

pkg_add ./zip-2.3p0.tgz
pkg_add ./unzip-5.52.tgz

Install batik

cd /usr/local/share/

Test batik

cd batik-1.6/samples
java -Djava.awt.headless=true -jar ../batik-rasterizer.jar ./barChart.svg

Configure DNS, order domain etc.

(change takes about 24h to take effect)

Configure DNS at DynDNS

Let DynDNS point at local webserver for web traffic and Crystone servers for mail traffic.

A records  Dynamic IP            WWW  Static IP    Mail  Static IP

MX records

CNAME records                WWW         Mail

Check information at

Setup local mail client

Incoming (POP3) server: (port 110)
Outgoing (SMTP) server: (port 25)

password: postmaster_pw
password: info_pw

Automate backups of Instiki

Set empty pass phrase.

dummy text ...

cat >> .ssh/authorized_keys

Shell script for backup of MySQL databases

Other tasks

Peter Ljung 2006 (C)