Old PC as AirPlay receiver with Shairport & Ubuntu

The steps in this tutorial are designed to allow an old laptop with Ubuntu server – without any desktop environment installed – to output audio through the headphone jack, while acting as an AirPlay receiver for iPhones, iPads, and Macs.

The steps in this tutorial work with newer versions of Ubuntu server, all the way back to the 10.04.4 LTS release. The 10.04.4 release may be a good choice if your laptop is very old, since it’s lightweight and runs well on older hardware with little RAM. However, be aware that support for this version will be dropped in 2015.

You don’t need to select any additional packages during the installation, such as server or desktop – all the following commands work no matter how you configured your installation.

You’ll need to have an Ethernet cable connected to the laptop during the initial installation steps. If you would like to use the laptop with WiFi once the initial configuration is done, there are additional steps at the end of this tutorial describing how to enable the WiFi adapter to automatically connect to your WiFi network upon startup.

First, download a server version of Ubuntu from the Ubuntu website.

Enable the Audio Hardware

To get audio working, the Alsa libraries have to be installed, and then PulseAudio has to be installed and configured.

Alsa:

PulseAudio:

Configure PulseAudio to run as a service, so that local logon is not required:

Edit /etc/default/pulseaudio:

Add/change the following two settings in /etc/default/pulseaudio:

Start the PulseAudio service (or reboot):

Run the following command to set the volume levels for the sound devices in the system:

Test that playback is working with the following command:

Install ShairPort

Install git:

OR

Install the perl libraries in order to build perl SDP extensions:

Use git to clone the perl-net-sdp project:

Use git to clone the Shairport project:

Edit the /etc/init.d/shairport file with the name you want your AirPlay receiver to have:

Find the following line in /etc/init.d/shairport and add -a name:

Start the Shairport service with the following command (or simply restart):

Check your AirPlay options on your iPhone, iPad, or Mac. You should see your laptop listed!

If you have any trouble getting the sound to work, check the Ubuntu documentation pages here (older versions) and here (newer versions).

OPTIONAL: WiFI network configuration for Ubuntu server

These steps configure your laptop to connect to your WiFi network at boot, so that you don’t have to have an Ethernet cable connected for AirPlay functionality.

You will need to have drivers installed for your WiFi card. They may already be included in Ubuntu, but if necessary, more information is available in the Ubuntu documentation.

Install wifi tools, wavemon, and the wpa_supplicant package:

Create the wpa_supplicant.conf file containing a hashed version of your WiFi network password:

Edit the /etc/wpa_supplicant/wpa_supplicant.conf file:

It should look something like the following – the values below are for a WPA2 network. Check the wpa_supplicant.conf documentation for connections to other kinds of WiFi networks:

Edit /etc/network/interfaces with values for your WiFi adapter. The example below uses wlan0 – if you have more than one WiFi adapter, you may have to specify wlan1 or wlan2 instead of wlan0.

Issue the following command to bring up the WiFi adapter:

Check to see if you’ve connected and received an IP address with the following command:

Use wavemon and iwconfig to view information about your WiFi connection:

If everything is correct, restart your computer, and make sure that the WiFi network started automatically.

Comments

comments

2 Comments

  1. Hi,

    I followed every step of your Tutorial closely, but I can’t get it to work. The Shairport does not show up in my iOs Devices 🙁

    • Oh no! Try running the Shairport.pl script directly instead of as a service, and see if it shows up. First, make sure the shairport service is not running with this command:

      service shairport stop

      Next, cd to the directory where you downloaded Shairport. This is most likely in your home directory in the shairport folder. Run this command:

      ./shairport.pl -a NameOfDevice

      Does your laptop show up then on your iOS devices?

1 Trackback / Pingback

  1. Timothy

Leave a Reply

Your email address will not be published.


*