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 for my local surf club (SurfclubKlagshamn). 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 base installation (all sets) of OpenBSD 3.9.
# adduser
Note: Invite into wheel group
# 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 the following line to /etc/fstab
/dev/cd0a /mnt/cdrom cd9660 ro,noauto 0 0
# pkg_add ftp://ftp.sunet.se/pub/OpenBSD/3.9/packages/i386/nano-1.2.5.tgz
Add the following lines in /root/.profile (use nano)
# Package handling
PKG_PATH=ftp://ftp.sunet.se/pub/OpenBSD/3.9/packages/i386/
FETCH_PACKAGES=yes
PKG_CACHE=yes
export PKG_PATH FETCH_PACKAGES PKG_CACHE
Allow port forwarding IPv4, IPv6
See PF_CONF file for an example
# cd /usr/ports/net/ddclient
# make install
# 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
# cp /mnt/cdrom/other/local.0 /usr/local/man/cat1/local.0
See http://wiki.rubyonrails.com/rails/pages/RailsOnOpenBSD
Install Ruby
# pkg_add ruby-1.8.4p1.tgz
Install gems
# tar xvzf rubygems-0.8.11.tgz
# cd rubygems-0.8.11
# ruby setup.rb
# pkg_add ruby-iconv
# gem install rails
# gem install \RedCloth
Install fastCGI
# pkg_add fcgi-2.4.0p1.tgz
# gem install fcgi
# pkg_add mysql-client-5.0.21.tgz
# pkg_add mysql-server-5.0.18.tgz
Set root password
# mysql -u root -p
(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 'peter'@'localhost' IDENTIFIED BY '<password>';
mysql> exit
# pkg_add lighttpd-1.4.10p1
# mkdir /var/www/pages
# mkdir /var/www/pages/rails
Edit /etc/lighttpd.conf
# 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 http:/92.168.0.6/testapp/say/hello
# 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
# instiki.sh (not the port that it is started on)
Go to http:/92.168.0.6:<port>/
Wiki name: wiki password: pw
Edit /etc/rc.local to start MySQL, lighttpd and ddclient
# 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> |
...
</div>
</div>
Restart _lighttpd_
# pkill lighttpd
# lighttpd -f /etc/lighttpd.conf
# ftp ftp://ftp.sunet.se/pub/OpenBSD/3.9/packages/i386/zip-2.3p0.tgz
# pkg_add ./zip-2.3p0.tgz
# ftp ftp://ftp.sunet.se/pub/OpenBSD/3.9/packages/i386/unzip-5.52.tgz
# pkg_add ./unzip-5.52.tgz
# cd /usr/local/share/
# ftp ftp://ftp.sunet.se/pub/www/servers/apache/dist/xml/batik/batik-1.6.zip
# unzip batik-1.6.zip
Test batik
# cd batik-1.6/samples
# java -Djava.awt.headless=true -jar ../batik-rasterizer.jar ./barChart.svg
Temprary password must be obtained using reset mail address att NIC-SE.
ns1.mydyndns.org 63.208.196.92
ns2.mydyndns.org 204.13.249.82
ns3.mydyndns.org 63.209.15.211
ns4.mydyndns.org 213.155.150.206
ns5.mydyndns.org 63.208.196.93
(change takes about 24h to take effect)
Let DynDNS point at local webserver for web traffic and Crystone servers for mail traffic.
A records
surfclubklagshamn.se 81.226.187.216 Dynamic IP # WWW
mailadmin.surfclubklagshamn.se 83.168.245.34 Static IP # Mail
webmail.surfclubklagshamn.se 83.168.245.33 Static IP
MX records
mx11.azalea.se
mx13.azalea.se
CNAME records
www.surfclubklagshamn.se surfclubklagshamn.se # WWW
mail.surfclubklagshamn.se mail.mailkluster.azalea.se # Mail
Check information at http://www.dnsreport.com/tools/dnsreport.ch?domain=surfclubklagshamn.se
Incoming (POP3) server: mail.surfclubklagshamn.se (port 110) Outgoing (SMTP) server: mail.surfclubklagshamn.se (port 25)
user: postmaster@surfclubklagshamn.se password: postmaster_pw user: info@surfclubklagshamn.se password: info_pw
Create backup script (backup.sh)
Configure sftp on server to accept empty password
Create host key pair. Run the following in host machine
# ssh-keygen -t dsa
(set empty passphrase)
Upload public key, ~/.ssh/id_dsa.pub, to backup server using e.g. sftp.
Add id_dsa.pub contents to ~/.ssh/authorized_keys (file may not exist and must then be created)
bla, bla
cat id_dsa.pub >> .ssh/authorized_keys
bla, bla
Add backup.sh file to /etc/weekly script
Peter Ljung 2006 (C)