"Never memorize something you can look up", Albert Einstein

Lightweight Subversion server with OpenBSD

Introduction

Recently I bought a cheap and power-expensive 500MHZ computer at Microclient with a 3.9GB’s Solid State Disc (SSD) and 256MB of Random Access Memory (RAM). I never could have guessed at that moment that it would cost me so much time and energie to get it up and running. The reason for me not knowing OpenBSD that good would probably be the main source.

Pre-History

Before coming with the idea to run OpenBSD on it I began my testing with FreeBSD because OpenBSD lacks some performance, but I discovered that FreeBSD required additional kernel-parameters for the CF-IDE to work (DMA isn’t supported on the mainboard) and I needed THREE yes THREE floppydiscs to boot the kernel and OS for the installation. OpenBSD only requires one floppy for the network-installation. Back on OpenBSD that meant.

Floppy on USB (FDD-USB)

If you looked at the MicroClient site you probably saw that there is no floppydrive on the device and no CD-ROM. You probably wonder why I dragged about those floppydiscs. Well the MicroClient-device has USB-connectors and IDE, that’s about it.

So I looked at a possibility to boot the device by USB, and it was easier than I thought. I booted my laptop with my RescueCD (stil running Windows on my laptop, I know it isn’t cool) and downloaded the floppyimage. After that simply put the USB-stick into the PC and with the DD-command send the floppyimage over to the USB-stick.

dd if=floppy42.fs of=/dev/sda1

Note: Not all USB-sticks support USB-booting. I’ve tried two sticks and only one of them worked.

After this I went into the BIOS (For people wondering how to do this on a MicroClient: Simply press F12 at boot and ONLY press this key, pressing any other key by accident or pressing the key to late will let the system simply ignore your input) I set the first boot-device to be ‘FDD-USB’. After that Save your changes and the USB-stick will boot..

OpenBSD installation

Well finally we got the OpenBSD-installation, when I first used this installation I hated it being so primitive without any correction when you enter a slash too much. Now I love it, being so simplistic makes the code way smaller and makes it possible to put the complete installation onto one disc, anyway I’m going off-topic.

Because I only have 3.9GiB’s of diskspace and I don’t want to waste too much space on things I don’t need I started to play with the packages and partition-size to be as small as possible. What I wanted was simple:

  • pkg_add to install packages
  • Subversion

After some 4 times or reinstalling and messing up things I came to the conclusion that you have space enough(Table2) when following the minimum space requirements(Table1) from OpenBSD-documentation FAQ and sticking to only 4 packages (Table3).

You may probably not wonder why I removed xgames42.tgz and man42.tgz but maybe do wonder why removed the comp42.tgz and misc42.tgz. Well one thing I love about OpenBSD is that you can simply download the package, see what’s in it and take a decision if it’s worth installing. misc42.tgz is a easy one, according to the OpenBSD site(2) it contains setup documentation and misc info. Well I downloaded the file and came to the same conclusion, dump it. comp42.tgz contains a lot more valuable information you think, compiling headers etc.. But because we only need pkg_add we can safely remove it.

OpenBSD firstboot

The firstboot can take some time, the system will be creating your SSL-credentials for openSSH. Yes you hear me right SSH is up and running when the firstboot is completed and the loginscreen comes to the front. So after the boot is completed fire up your favorite SSH-client (for instance PuTTy) and connect.

Warning: By default OpenBSD gives access to the root-account through a SSH-connection. OpenBSD Security

Subversion installing

Finally we can start installing Subversion, inform OpenBSD where we can retrieve the package-server:

export PKG_PATH=ftp://mirror.hostfuss.com/pub/OpenBSD/4.2/packages/i386

And after that retrieve the lastes version of Subversion.

pkg_add -r subversion

You would think this all would go without a problem, but unfortunatly this isn’t the case. We get an error with remarks like “expat.so.8.0 is missing”. After some internet searching I found out this library is part of the xbase42.tgz, luckily for me a comment as placed giving the hint to extract the expat-file from the xbase42.tgz by hand and putting it on the system. At first I placed the library at the exact space where it would be placed if I ran the installer. After some testing I found out this did the trick with the pkg-manager but that SVN would not accept it. The solution is easy: simply place it in **/usr/lib**.

So you need to extract three files from the xbase42.tgz:

  1. libexpat.a
  2. libexpat.so.8.0
  3. libexpat_pic.a

After extraction simply place them in the **/usr/lib**.

cp lib* /usr/lib

One this is done the installation of Subversion will finish without an error, now we’re here the only last thing to do is create an account to use for SVN (logging in as root for this is quite dumb) and configuring the client to use a SSH-connection.

Subversion post-installation

So we add an user, OpenBSD has a ready-to-use script for us here, simply press ‘adduser’ and enjoy the ride. The only last thing to do is logout as the root and login with your created account so create a ‘SVN-repository’. This is also one simple command (BlatherSkite):

svnadmin create foldername

Once this folder is created SVN on the server-side is done, only thing that remains is client-side.

Client-side

SVN has multiple way’s of accesing the repository like Apache2 WebDav and SSH. My preference goes to SSH because it requires less packages on the server and requires no additional hassle and headaches regarding securing the server with a certificate/configuring it.

SVN+SSH-protocol description

For Linux configurating: [BlatherSkite][]
For Windows configurating: [Windows SVN][]
Interested how this works? [SVN Bible][]

Apache2 interesting documentation

[ApacheSubversionRecipe][], Setting up secure HTTP with SSL [FAQ2][], Apache2 with subversion SVN and DAV, Apache HTTP server (FreeBSD Apache), Subversion and Apache walkthrough for OpenBSD-people (BSD SVN).

One your server is configured you can easilly use Subversion, but the server can be higher secured, for more information about this I would recommend OpenBSD 4.2 Security Recommendations (OpenBSD Security).

(root)60MB
(swap)32 MB
/usr420M
/tmp50MB
/var4GB

*Table1. Partition sizes*

Filesystem512-blocksUsedAvail CapacityFreeMounted on
/dev/wd0a120156597325442052%/
/dev/wd0e1003804953600%/tmp
/dev/wd0d84367623368456781229%/usr
/dev/wd0f65654361017262269960%/var

*Table2. Freespace*

bsd
bsd.rd
base42.tgz
etc4242.tgz

*Table3. Installed packages*

Sources

  1. Microclient
  2. FAQ
  3. PuTTy
  4. BlatherSkite
  5. Windows SVN
  6. SVN Bible
  7. ApacheSubversionRecipe
  8. FAQ2
  9. SVN+DAV]
  10. FreeBSD Apache
  11. BSD SVN
  12. OpenBSD Security

 


Only members are allowed to post a comment.

Comments

No comments have been placed.