Run OpenBSD CURRENT on MacOS X

Why?

All my OpenBSD hardware run RELEASE version of OpenBSD. Even my laptop run RELEASE because I don't want to have any problem with it. But sometimes it is useful to have a CURRENT OpenBSD install to try out or develop new ports on.

This is the case with the new minidlna port which I can't wait to try out. I also made an attempt to create this port myself which I may continue with some time.

OpenBSDOnMac.png

Also I don't have any unused suitable hardware to just test ports on. So I decided try to install OpenBSD CURRENT on a VirtualBox VM hosted by MacOS X Mountain Lion on Mac Mini hardware.

Install Virtual Box

First install "VirtualBox 4.2.1 for OS X hosts" from the following link.

https://www.virtualbox.org/wiki/Downloads

Install was a breeze through the installer application.

Create a Virtual Image

I created a virtual image through the New icon. I configured it to 256 MB RAM and 4GB diskspace (dynamically allocated) file image. VT-x/AMD-V seems to to enabled by default on my recent Mac Mini.

You need an install iso image to make the initial OpenBSD install. Download the latest snapshot.

ftp ftp://ftp.stacken.kth.se/pub/OpenBSD/snapshots/i386/install52.iso

Now press Start icon and select the install52.iso as install media.

Make a normal install. I use default settings for everything.

Update ports tree

First I downloaded ports.tar.gz from the snapshots (your preferred) ftp folder. Unpack it in the /usr folder.

cd /usr
ftp ftp://ftp.stacken.kth.se/pub/OpenBSD/snapshots/ports.tar.gz
tar xzf ports.tar.gz

Next I updated the ports tree with latest changes through anoncvs.

cd /usr
cvs -qd anoncvs@anoncvs.eu.openbsd.org:/cvs get -P ports

To update at a later point just.

cd /usr
cvs -q up -Pd

Build the bleeding edge package, minidlna

In my case I wanted to try out minidlna.

To avoid compiling all dependent ports I first installed dependencies as packages from the snapshots package repository. Replace i386 with your architecture.

ecport PKG_PATH=ftp://ftp.stacken.kth.se/pub/OpenBSD/snapshots/packages/i386
cd /usr/ports/multimedia/minidlna
make print-build-depends
make print-run-depends
pkg_add ...

To build the ports just run.

cd /usr/ports/multimedia/minidlna
make install

To see all possible make targets see bsd.port.mk(5).

One of the great things about minidlna is that it is super easy to configure. Edit /etc/minidlna.conf to set it up.

minidlna.conf

Then try to start it.

minidlna -d

You may also want to use the rc.d to start the application.

/etc/rc.d/minidlna start      # or stop/restart

When minidlna was installed I realized that the virtual disk was to small to hold my media files. So I added a new disk in Virtual Box and installed it from OpenBSD. Now I have some space to put media in.

fdisk -i wd1
disklabel -E wd1          # create a single a partition
newfs wd1a
mkdir /media
mount /dev/wd1a /media

To make the disk show up on next boot I also added it /etc/fstab.

/dev/wd1a /media ffs rw,nodev,nosuid,softdep 1 2

To make the virtual host act a a local host you need to configure VM network adaptor as "Bridged Adapter". When this is configured you can access minidlna from your local network through e.g. VLC.

You can auto start minidlna on boot by adding the following to /etc/rc.conf.local

pkg_scripts="minidlna"

And all this worked! Now I can play by Battlestar Galactica episodes from all my network.

References