If you, like me, own one or more Squeezebox players you can either choose between the service mysqueezebox.com, that streams music from the internet, or set up the Squeezebox server on your own network. The Squeezebox server software (aka Logitech Media Software) being free and open source software guarantees that you’ll take control of your Squeezebox players and the music that you’re streaming.
There many hardware options for the Squeezebox server software (or Logitech Media Server) but I decided to use the Raspberry Pi 2 that I had lying around because of it’s small footprint and massive support for the Pi. Within a couple of hours I had the Logitech Squeezebox Server up an running with my music playing.
Below I’ll show how to set up the Logitech Squeezebox Server on a Raspberry Pi in five steps. I got some important steps from the Variax Firmation website but I tested everything succesfully.
Step 1: Ripping CD’s and writing them on an HDD (choosing an audio format)
Before setting up a server rip the CD’s and write them to a HDD. For this project I used a small usb-harddrive that was also lying around. I formatted the HDD as FAT32. Next I collected all my music CD’s and ripped them. As ripping software I used the Asunder software on my Linux system but I guess that the’re good alternatives (fre:ac appears to be an free and open source alternative that is also available for OSX and Windows). As audio format I choose mp3. If I buy a larger drive I’ll probably move to flac.
Step 2: Installing Raspbian Lite
Next I installed Raspbian Lite (currently Raspbian Buster Lite) on the Raspberry Pi 2 by first downloading the image and writing the image to the micro SD card using these instructions for OSX (or these instructions for Windows and Linux). I chose the lite version of Raspbian to make the server as lightweight as possible. I had no problems booting the Raspberry Pi and connecting it to my network using ethernet. To avoid potential problems connect the Pi to a monitor with an HDMI cable and make sure that it boots properly.
Step 3: Mount the HDD on the Raspberry Pi
Now with Raspbian Lite installed I mounted the HDD that we prepared in step 1. For this first connect the HDD to the Raspberry Pi (in my case I connected the HDD through a USB port of the Raspberry Pi), login remotely and retrieve the name of the drive. To login remotely we need another computer (Windows, Linux or OSX). Open a terminal (or Putty in case of Windows) and type:
sudo ssh pi@Raspberry_Pi_ip_address (in my case 192.168.178.69)
The default password is raspberry. Then type:
sudo fdisk -l
Then look for the HDD that is just connected. This was /dev/sda1 in my case (but this may differ in yours). To make the files on the HDD accesible to the Raspberry Pi we need mount the drive. But before that we need to make a mounting point (in this example at ~/media/usb-drive).
sudo mkdir /media/usb-drive
sudo mount /dev/sda1 /media/usb-drive
You should hear some HDD activity. Now type:
cd /media/usb-drive ls -l
and a list of your music should be visible.
To unmount the HDD do:
sudo umount /media/usb-drive
Step 4: Installing Logitech Media Center on the Raspberry Pi
First we need to install a library to play audio files. Since you want mp3 only do:
sudo apt-get install -y libsox-fmt-all
This installes SoX, a command line utility that, among other things, plays various types of audio files. If you want to add flac support you’ll probably need to do this
sudo apt-get install -y libsox-fmt-all libflac-dev
Now with the audio libraries in place the Logitech Media Software can be downloaded. We want the latest version which is 7.9.2.
wget -O logitechmediaserver_all.deb $(wget -q -O - "http://www.mysqueezebox.com/update/?version=7.9.2&revision=1&geturl=1&os=deb")
Now install the server software with:
sudo dpkg -i logitechmediaserver_all.deb
With all the software installed we’re ready to go.
Step 5: Working with Logitech Media Center
To enter the web interface of the Logitech Media Center on the Pi we need a computer and a browser. In the browser url we type:
<your_Raspberry_Pi_ip_address:9000> (in my case 192.168.178.69:9000)
The Logitech Media Center is started for the first time and a script is started to set it up. Important is that the mounting point of the HDD (in my case /media/usb-drive) is entered. This way the Media Center is able to retrieve all the music files. This is done in the web interface by entering the path of the mounting point under Media Settings under Media Folders.
The Logitech Media Server is now ready and every time the Raspberry Pi boots the Logitech Media Server is automatically started however the HDD is not automatically mounted so we need to change that. This is done by editing (with nano) the fstab system configuration file that can be found at /etc/fstab
sudo nano fstab
and add the following line
/dev/sda1 /media/usb-drive vfat& defaults 0
Save the file and exit nano. Reboot the Raspberry Pi. Now the installation is complete. The music can be played from the web interface (see above), with the remote controls that come with the Squeezebox devices or with a free app for Android. The Squeezebox Radio also has controls on the device to play the music. So, plenty of options.
In a future blog entry I’ll explain how to maintain the Logitech Media Server e.g how to add music to the server remotely.