My Raspberry Pi setup

16 Jun 2014

A quickstart for headless Raspbian setup with shairport and WiFi.

Many tutorials for the RPi have a lot of text. I am more of a command line guy which just wants to know the commands. So here is my quickstart for a headless Raspbian setup (version 2014-01-07) with shairport. NB: I use a macbook pro and I don't have any external monitors, so I have to do it headless.

I will follow this tutorial. It uses sudo on places where it shouldn't to and some steps are not needed. Hence my own version of that tutorial. This is completely self contained: we will setup the SD card, then configure the RPi, then install shairport with its dependencies and finally setup a wifi dongle.

Prepping the SD

I first formatted my SD card to give it a name. It then shows up with the command df, as you can see:

Now we know it is disk1s1 internally. We want to write to the raw buffer which is called rdisk1 (this is mac specific, I believe). Next we will unmount it, write the image (this will take a while) and eject it.

Config

We are now ready to put this in our RPi. Put it in, plug the ethernet cable in and fire it up. It will be ready for usage shortly after. Now we need to know its IP address. I just guessed it (my mac was on 192.168.1.106, so I tried 107) by pinging: ping 192.168.1.107. One of the LEDs will react to the pings, so you're sure it is the right device. Log in (and accept the keys, yadayada):

~$ ssh pi@192.168.1.107
[...]
NOTICE: the software on this Raspberry Pi has not been fully configured. Please run 'sudo raspi-config'
pi@raspberrypi ~ $

Succes!!! We now can continue with the config.

pi@raspberrypi ~ $ sudo raspi-config

First thing you want to do is expanding the filesystem. Then I enabled modest overclocking. I changed the hostname in the advanced settings. Finally I force audio from the 3.5 jack, as that will be my intended use. Hit finish and reboot.

I was a bit surprised to not find any timezone settings in this menu. You can do this yourself:

Shairplay

At this point we are going to install some software. We will follow this tutorial. We are at the point where we update our package list and upgrade the packages (will take several minutes, have you cleaned up your desk already?):

sudo apt-get update
sudo apt-get upgrade

We will use shairport, which depends on perl-net-sdp. Looking at the depencies we reckon we need to install the following Debian packages (we already have build-essential and pkg-config installed). Again this might take a while (now it's time to clean up the other half of your desk).

On line 22 we can specify a name (with the -a flag) as shown above. Once saved, reboot, and check if it's working.

There seems to be a lot of forks of shairplay. The most up to date one seems to be shairport-sync. While the official version seems to be here. I was stupid enough to blindly follow the original tutorial, hence we ended up with an old version.

Wifi

I got my wifi adapter from DealExtreme. It was the cheapest I could find (only 4.30 euro). After plugging in the adapter, the RPi seems to reboot, so wait for a moment and log back in. Install the following and run:

sudo apt-get install wicd-curses
wicd-curses

It should display a list of available networks. Highlight yours and configure it (right arrow). Here you should enter the password and enable autoconnect, hit F10. Now connect with enter. Wait. Since it now uses a different network, the RPi's IP address will probably change, and you'll have to reconnect. Once on wifi, unplug the cable, reboot and see if everything works!

That was all! I or my friends can now stream music from any device to our audio system without any hassle (modulo occasional crashes). I am happy with this setup (and the free RPi from transip).