Create an AirPlay server using Raspberry Pi (Apple iTunes server clone)

I recently came across forked-daapd, forget what the name means. If you’ve ever setup your iTunes app as a music server, well this is a clone of that.

This means you can use a remote on your iPhone, iPad, or Android device to control the iTunes music server to play music on remote speakers (with the use of Apple’s Airport Express WiFi device).

I started with a scratch Raspberry Pi install, this time around I’m using the latest distribution of Raspbian named Stretch.

You can use instructions on this page to install Stretch on your Raspberry Pi:

https://www.raspberrypi.org/documentation/installation/installing-images/README.md

Once that is done, you’ll then want to install what is called a repository key. A repository is basically a server that contains applications you can install. A gpg key is a digital signature used to authenticate the repository.

The command to get the repository key is:

wget -q -O – http://www.gyfgafguf.dk/raspbian/forked-daapd.gpg | sudo apt-key add –

Then we want to add the following line to /etc/apt/sources.list, make sure it is the first line in the file, otherwise it will pick up an old version of forked-daapd. This adds the repository that contains forked-daapd to our software install list before the default list so we can install the latest forked-daapd.

deb http://www.gyfgafguf.dk/raspbian/forked-daapd/ stretch contrib

Note that if you have Raspbian Jessie, you can replace the word stretch above with “jessie”.

Now we can install forked-daapd with this command, it takes about a minute or so:

sudo apt update && sudo apt install forked-daapd

Once installed, you have to configure forked-daapd’s configuration file:

sudo nano /etc/forked-daapd.conf

Look for the line that looks like: directories = { “/srv/music”}

Replace the directory “/srv/music/” with wherever you have your music located.

That’s all you have to do with this configuration file.

I have in a USB drive in a directory named “Music” so I first mount the USB drive by editing /etc/fstab file (so it’ll mount everytime the Pi reboots) like so:

/dev/sda1       /media  vfat    defaults,ro     0       0

Note I’m using /dev/sda1 which is the USB disk with the “Music” directory. Also note the “ro” parameter, it means read only so you don’t accidentally write over your music files.

Mounting the USB drive is achieved by issuing this command:

sudo mount -a

So, now you have forked-daapd installed, music mounted, time to make it work:

# start forked-daapd
sudo service forked-daapd start

# check status to see if it started successfully
sudo service forked-daapd status

You should see something like this (sorry for the blur, it’s WordPress’ doing):

Note the green text “active running” that means it is running succesfully. You can also check this file to see how forked-daapd file is doing:

sudo less /var/log/forked-daapd.log

I hope everything went well with no errors. If so, it’s time to add our remote.

For Apple devices, download the Remote app.

For Android devices, I have the best experience with TunesRemote+ app.

To pair your devices with forked-daapd use the following page, starting with Pairing with Remote on iPod/iPhone:

https://github.com/ejurgensen/forked-daapd/blob/master/README.md

With TunesRemote+ I found the pairing instructions above not working. Fortunately there is a workaround by adding the music library manually (i.e. enter the ip address of the forked-daapd server).

forked-daap has a very helpful and responsive help thread here:

https://www.raspberrypi.org/forums/viewtopic.php?f=66&t=49928&hilit=forked+daapd

That’s it!

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s