SymPiosis – porting our Symbiosis hosting environment to Raspberry Pi

Ever since we got our hands on Raspberry Pis, we’ve been tweaking, testing and playing with them to explore their abilities. There’s already plenty of examples of how to set it up as a server. But setting up a basic server isn’t quite the same as creating a hosting environment, complete with the ability to deploy websites, mailboxes and all the other useful things you need.

So we asked: could we get the Raspberry Pi to run Symbiosis?

Symbiosis is our own open-source software that already powers thousands of servers. Simply put, Symbiosis is an easy-to-use server management environment that makes setting up repetitive tasks like email, websites etc easy and simple for the non-technical user while integrating well with Debian GNU/Linux.

Symbiosis includes everything you’d need to set up a working server such as LAMP and a mail stack. For simplicity, it’s administered almost entirely through – wait for it – FTP. If you can work FTP, you can setup websites and mailboxes with advanced features such as spam filtering and webmail. SSH is also fine, of course.

And given that Symbiosis runs on Debian/squeeze, we thought porting it to Raspbian (based on wheezy) would be a breeze(y)…

Well, not quite. The good news is, it works! “SymPiosis”, as I’m dubbing it, does run on a Raspberry Pi with some tweaking, though with some bits not quite working and missing – primarily due to the switch from squeeze to wheezy. The bad news is, it requires a smidge of work to get going.

SymPiosis - now with added ASCII art

SymPiosis - now with added ASCII art!

Building Symbiosis for the Raspberry Pi

Patrick, lead developer explains his build process:

Just a note – we’ve already built the Symbiosis packages for you (see below), so you don’t need to follow these instructions, unless you wish to build the packages for yourself.

Here at Bytemark we use the sbuild system to build Debian packages, so the first challenge was setting up a chroot on our “maker” box which would build packages for the Pi. Once set up, the build went well giving us a load of debian packages which I’ve put up in our Symbiosis repository.

However the packages can be built on the Pi itself. To do this you need to be a bit more adventurous. All the source code is available at https://projects.bytemark.co.uk/hg/symbiosis and the steps for building them are (essentially):

$ sudo apt-get install --no-install-recommends mercurial ubuntu-dev-tools equivs
$ hg clone https://projects.bytemark.co.uk/hg/symbiosis
$ cd symbiosis
$ for i in */debian/control ; do mk-build-deps -s sudo -i $i ; done
$ rake Release

Once that has completed you should be away!

Installing Symbiosis for the Raspberry Pi

Firstly I took the stock Raspbian image available at http://downloads.raspberrypi.org/raspbian_latest and copied onto a 4G SD card using dd. I’d say that 4G is the smallest card that you’ll want to use.

$ wget http://downloads.raspberrypi.org/raspbian_latest -O 2013-07-26-wheezy-raspbian.zip
$ unzip 2013-07-26-wheezy-raspbian.zip

Then, assuming your sd card is /dev/sdb…

$ sudo dd if=2013-07-26-wheezy-raspbian.img of=/dev/sdb bs=8M

Stick the card in the Pi and power on. Once booted, expand the root partition to fill the SD card, otherwise there isn’t quite enough space to play with. Then reboot.

Firstly we need to make sure the Pi loads the IPv6 module on boot. So login as the default user “pi” with the password “raspberry” and run:

$ sudo sed -i -e '$ a ipv6' /etc/modules
$ sudo modprobe ipv6

Once that has been done we can create our apt sources.list for Symbiosis:

$ echo "deb http://symbiosis.bytemark.co.uk/raspbian-wheezy.prerelease/ ./" | sudo tee /etc/apt/sources.list.d/symbiosis.list

Add in our GPG key:

$ curl http://repo.bytemark.co.uk/packages/apt-key.pub | sudo apt-key add -

And finally now we can install!

$ sudo apt-get update $ sudo apt-get install --install-recommends bytemark-symbiosis

We have to use ruby1.8 for the time being until the wheezy packaging is fixed:

$ sudo update-alternatives --set ruby /usr/bin/ruby1.8

Once that is done, we should have a working Symbiosis box. Please bear in mind that this a pre-release of our wheezy packages, and there might be warnings from the various bits of software (especially Dovecot which has moved from 1.x to 2.x in wheezy).

Web-based control panel

For extra points, you can install the experimental web-based control panel, available at https://github.com/kgfullerton/symbiosis-spanel. To get this going in an easy manner, you need to install a few bits.

$ sudo apt-get install thin ruby-sinatra ruby-rack git

Before we start the panel, we need to poke a hole in the firewall.

$ touch /etc/symbiosis/firewall/incoming.d/70-9292

We have to reload the firewall manually. Automatic reload isn’t working yet.

$ sudo /usr/sbin/symbiosis-firewall

Now check out the repo somewhere sensible:

$ sudo su admin
$ mkdir -p /srv/my-brilliant-site.com/public
$cd /srv/my-brilliant-site.com/public
$ git clone https://github.com/kgfullerton/symbiosis-spanel

To access it you need to have an admin user. To do this, create a mailbox with a password.

$ mkdir -p /srv/my-brilliant-site.com/mailboxes/admin
$ cd /srv/my-brilliant-site.com/mailboxes/admin
$ symbiosis-encrypt-password "correct horse battery staple" > /srv/my-brilliant-site.com/mailboxes/admin/password
$ touch /srv/my-brilliant-site.com/mailboxes/admin/admin

Now we’re ready to start the panel:

$ cd /srv/my-brilliant-site.com/public/symbiosis-spanel
$ rackup

You should now be able to point your browser at your machine’s IP address, and login using “admin@my-brilliant-site.com” as the username, and “correct horse battery staple” as the password (all without inverted commas). Massive thanks to Kevin Fullerton for writing this panel.

So, by following the instructions, you should be able to build and install SymPiosis on a Raspberry Pi. The next step? Get hosting – have a browse of our documentation which explains how to set up websites, mailboxes and other features.

Just remember, this is pre-Alpha and totally unsupported for now – but we hope to keep it updated as we progress towards building Symbiosis for wheezy.

Have you tried this out? Do you have any feedback? If so, drop a comment on the blog post below.

Josh + Patrick @ Bytemark