1Simple Installation Instructions 2== 3Here are simple instructions for building and installing Shairport Sync on a Raspberry Pi B, 2B, 3B, 3B+ or 4B. It is assumed that the Pi is running Raspbian Buster Lite – a GUI isn't needed, since Shairport Sync runs as a daemon program. For a more thorough treatment, please go to the [README.md](https://github.com/mikebrady/shairport-sync/blob/master/README.md#building-and-installing) page. 4 5In the commands below, note the convention that a `#` prompt means you are in superuser mode and a `$` prompt means you are in a regular unprivileged user mode. You can use `sudo` *("SUperuser DO")* to temporarily promote yourself from user to superuser, if permitted. For example, if you want to execute `apt-get update` in superuser mode and you are in user mode, enter `sudo apt-get update`. 6 7### Configure and Update 8Do the usual update and upgrade: 9``` 10# apt-get update 11# apt-get upgrade 12``` 13(Separately, if you haven't done so already, consider using the `raspi-config` tool to expand the file system to use the entire card.) 14 15### Turn Off WiFi Power Management 16If you are using WiFi, you should turn off WiFi Power Management: 17``` 18# iwconfig wlan0 power off 19``` 20WiFi Power Management will put the WiFi system in low-power mode when the WiFi system is considered inactive, and in this mode it may not respond to events initiated from the network, such as AirPlay requests. Hence, WiFi Power Management should be turned off. (See [TROUBLESHOOTING.md](https://github.com/mikebrady/shairport-sync/blob/master/TROUBLESHOOTING.md#wifi-adapter-running-in-power-saving--low-power-mode) for more details.) 21 22Reboot the Pi. 23 24### Remove Old Copies 25Before you begin building Shairport Sync, it's best to search for and remove any existing copies of the application, called `shairport-sync`. Use the command `$ which shairport-sync` to find them. For example, if `shairport-sync` has been installed previously, this might happen: 26``` 27$ which shairport-sync 28/usr/local/bin/shairport-sync 29``` 30Remove it as follows: 31``` 32# rm /usr/local/bin/shairport-sync 33``` 34Do this until no more copies of `shairport-sync` are found. 35 36### Remove Old Startup and Service Scripts 37You should also remove the startup script and service definition files `/etc/systemd/system/shairport-sync.service`, `/lib/systemd/system/shairport-sync.service`, `/etc/init.d/shairport-sync`, `/etc/dbus-1/system.d/shairport-sync-dbus.conf` and `/etc/dbus-1/system.d/shairport-sync-mpris.conf` if they exist – new ones will be installed if necessary. 38 39### Reboot after Cleaning Up 40If you removed any installations of Shairport Sync or any of its startup script files in the last two steps, you should reboot. 41 42### Build and Install 43Okay, now let's get the tools and sources for building and installing Shairport Sync. 44 45First, install the packages needed by Shairport Sync: 46``` 47# apt install --no-install-recommends build-essential git xmltoman autoconf automake libtool \ 48 libpopt-dev libconfig-dev libasound2-dev avahi-daemon libavahi-client-dev libssl-dev libsoxr-dev 49``` 50Next, download Shairport Sync, configure it, compile and install it: 51``` 52$ git clone https://github.com/mikebrady/shairport-sync.git 53$ cd shairport-sync 54$ autoreconf -fi 55$ ./configure --sysconfdir=/etc --with-alsa --with-soxr --with-avahi --with-ssl=openssl --with-systemd 56$ make 57$ sudo make install 58``` 59By the way, the `autoreconf` step may take quite a while on a Raspberry Pi -- be patient! 60 61Now to configure Shairport Sync. Here are the important options for the Shairport Sync configuration file at `/etc/shairport-sync.conf`: 62``` 63// Sample Configuration File for Shairport Sync on a Raspberry Pi using the built-in audio DAC 64general = 65{ 66 volume_range_db = 60; 67}; 68 69alsa = 70{ 71 output_device = "hw:0"; 72 mixer_control_name = "PCM"; 73}; 74 75``` 76The `volume_range_db = 60;` setting makes Shairport Sync use only the usable part of the built-in audio card mixer's attenuation range. 77 78The next step is to enable Shairport Sync to start automatically on boot up: 79``` 80# systemctl enable shairport-sync 81``` 82Finally, either reboot the Pi or start the `shairport-sync` service: 83``` 84# systemctl start shairport-sync 85``` 86The Shairport Sync AirPlay service should now appear on the network with a service name made from the Pi's hostname with the first letter capitalised, e.g. hostname `raspberrypi` gives a service name `Raspberrypi`. You can change the service name and set a password in the configuration file. 87 88Connect and enjoy... 89