update here

Raspberry Pi Media Center book by Sam Nazarko is available at amazon.com and amazon.co.uk.
I always wanted to stream music from my music player using network to serve each room. With AirPlay, Apple gave me an easy way to achieve it, but requires more device from that company. An Airport Express costs 99$/€, and even if I love my iPhone and my MacBook, I will never pay for a an Airport or AppleTV device.
With RaspberryPi, the foundation gave me the solution ! Around 30$/€ and some recycled extras, and we are up to enjoy AirPlay Audio, open source and low-cost. It relies on shairport, and we’ll make it without pluging any keyboard, mouse or display.
If we need a Video support, just deal with RaspBMC. But if you only want an audio player, read the rest of the post
Install Raspbian “wheezy”
Follow instructions given on the official raspberry website. Once you have your SD card ready, insert it in your Pi then plug Ethernet and Power cables in.
First boot and login
To log into your Pi with SSH, you need to know its IP adress.
If you have a decent DHCP/DNS server on your network, the Pi should have been registered on your DNS, so try ping raspberrypi from your computer command-line.

If it doesn’t work, you may try to log into your router to see DHCP leases/allocations.
You can also try all IPs of your network range, or use a network scanner like Fing (iOS) or Scapy (python).

When you have your Pi’s IP, you can login using SSH :
On Windows, you will need to download and install Putty.
On Linux/MacOS, open a terminal then type : ssh pi@raspberrypi (or replace raspberrypi with its IP)
When prompted, type the password raspberry
Right now, the first thing to do is to configure your raspbian :
pi@raspberrypi:~$ sudo raspi-config

I suggest to first update, then expand the filesystem, change the password, the locale and timezone. Keep SSH enabled and desktop start disabled. Finish and reboot when prompted.
It may take some time to expand the filesystem at reboot. Just wait few minutes then login using ssh again.
Gaining root access
root user is disabled for login, but you can become root if you are already logged to avoid multiple sudo
pi@raspberrypi:~$ sudo su
root@raspberrypi:/home/pi# cd
root@raspberrypi:~#
Upgrade Debian
At this step, it’s a good idea to upgrade pre-installed packages :
root@raspberrypi:~# aptitude update
root@raspberrypi:~# aptitude upgrade
Change audio output
To force audio output to stereo jack, a single line is required :
root@raspberrypi:~# amixer cset numid=3 1
Install shairport
Before download and compile shairport, we need to install prerequisites :
root@raspberrypi:~# aptitude install git libao-dev libssl-dev libcrypt-openssl-rsa-perl libio-socket-inet6-perl libwww-perl avahi-utils
Then download shairport sources and compile it :
root@raspberrypi:~# git clone https://github.com/albertz/shairport.git shairport
root@raspberrypi:~# cd shairport
root@raspberrypi:~/shairport# make
Finally, launch shairport foreground :
root@raspberrypi:~/shairport# ./shairport.pl -a AirPi
You can now use your iDevice to try AirPlay audio, don’t forget to plug an headphone or speakers into the 3.5mm stereo jack.

If you want or need your Pi load automatically shairport, follow next procedure :
root@raspberrypi:~/shairport# make install
root@raspberrypi:~/shairport# cp shairport.init.sample /etc/init.d/shairport
root@raspberrypi:~/shairport# cd /etc/init.d
root@raspberrypi:/etc/init.d# chmod a+x shairport
root@raspberrypi:/etc/init.d# update-rc.d shairport defaults
Before starting the daemon, we have to add the AP Name in the launch parameters. Edit the file using nano shairport then change the DAEMON_ARGS variable line so it looks like to :
DAEMON_ARGS="-w $PIDFILE -a AirPi"
Replace AirPi by whatever you want, save, quit and start the service to enjoy shairport in background and your AirPi :
root@raspberrypi:/etc/init.d# ./shairport start
To go more further, we can replace the Ethernet cord by a WIFI USB dongle, make a hole in a tupperware case for the power and audio cord, then place the Pi inside to get a bathroom-ready AirPi
You may notice some glitchy noise. This is due to the analog output, which is not a real DAC, but a simple PWM generator. A USB sound card will give you a better audio quality.