This is optional, but I like to setup from fresh when the pi is just being used for one purpose:
- Install the Raspberyy Pi Images: https://www.raspberrypi.org/software/
- Install a fresh copy of Raspberry Pi OS Lite on to an SD card
- Configure WiFi to run the pi headless (pay attention to the capitalisation of the network name, one wrong character had me scratching my head for a while):
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=<ISO alpha-2 country code>
network={
ssid="NETWORK_NAME"
psk="NETWORK_PASSWORD"
}- Save that with LF line endings as
wpa_supplicant.confin the rootbootdirectory on your SD card. - Enable SSH on the pi by doing
touch sshinsideboot. - Safely eject your SD card and put it in the Pi.
- Plug the Pi in to power and audio through the audio jack.
- Wait a few minutes for it to join the network. You can run
nmap -sn 192.168.1.0/24to see everything on the network or justping raspberrypi.localuntil it appears.
This is Liz Miller's brilliant guide found here. No credit taken, I just wanted to put all these instructions in one place for when my Pi inevitably shits the bed and I have to set it all up again.
ssh [email protected]sudo apt-get update && sudo apt-get install autoconf automake avahi-daemon build-essential git libasound2-dev libavahi-client-dev libconfig-dev libdaemon-dev libpopt-dev libssl-dev libtool xmltomangit clone https://github.com/mikebrady/shairport-sync.gitcd shairport-syncautoreconf -i -f./configure --with-alsa --with-avahi --with-ssl=openssl --with-systemd --with-metadatamakesudo make install- Liz says here to run
sudo raspi-configand then goAdvanced Options > Audio > Force 3.5mm (‘headphone’) jack. I didn't have to do this, the Audio section wasn't showing up in advanced options, maybe it's because my Pi is old 🤷🏻♂️. amixer sset PCM,0 100%from the guide didn't work for me, but you can adjust the volume of the Pi by runningalsamixerand just configuring it through there.sudo systemctl enable shairport-syncso that it launches on pi boot.
And done! It should show up as a new airplay speaker called Raspberrypi.
Although I've gone full Apple plenty of people use spotify, so it's pretty trivial to get a spotify connect server up and running using raspotify. This again is from another great guide written by Emmet here.
sudo apt update && sudo apt upgradesudo apt install -y apt-transport-https curlcurl -sSL https://dtcooper.github.io/raspotify/key.asc | sudo apt-key add -v -echo 'deb https://dtcooper.github.io/raspotify raspotify main' | sudo tee /etc/apt/sources.list.d/raspotify.listsudo apt updatesudo apt install raspotify
and that's it, it's running. If you want to make changes to the configuration (name, icon in spotify, bitrate etc) then run sudo nano /etc/default/raspotify, change the appropriate values, save + quit, then run sudo systemctl restart raspotify to restart it.
Last Spotify step:
sudo nano /etc/default/raspotifyis now replaced bysudo nano /etc/raspotify/confThanks so much for this guide!