Tuesday, August 22, 2017

Creating a Raspberry Pi Squeezebox server

Frustration with Spotify

In my last blog post I wrote how Spotify remotely deleted their app from my Squeezeboxes. This pissed me off and I wondered who was in control of the Squeezebox devices, me or some third party. It forced me to choose between the service, that streams music from the internet, or set up the Squeezebox server on my network. The Squeezebox server software being free and open source software guarantees that I take control of my Squeezeboxes and the music that I'm 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 the steps that need to be taken to set up the Logitech Squeezebox Server on the Raspberry Pi. I got some important steps from the Variax Firmation website but I tested everything.

Raspberry Pi 2 with a USB-harddrive connected to my network with an ethernet cable.

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 Tahrpup Linux system (6.0.5) but I guess that the're good alternatives. As audio format I choose mp3 for now. If I buy a larger drive I'll probably move to flac.

Step 2: Installing Raspbian Stretch Lite

Next I installed the just released Raspbian Strech Lite on the Raspberry Pi 2 by first downloading the image and writing the image to the micro SD card using these instructions.  I chose the lite version of Raspbian Stretch 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 we need to 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
The 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.
sudo mkdir /media/usb-drive
and mount
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

The list of folders with albums that I ripped. In this stage I only ripped a few albums to test the system.

Step 4: Installing Logitech Media Center on the Raspberry Pi

Before 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.0.
wget -O logitechmediaserver_all.deb $(wget -q -O - "")
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 

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.
sudo mkdir /media/usb-drive
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 in 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.

Webinterface of the Logitech Media Server.

What's next

To give the media server a permanent place a case is needed. Luckily I have a 3D printer and some 3D CAD skills so I'll create my own. I'll show the finished product in a future blog post. I also wonder if I could make this work on the C.H.I.P which would make the project even cheaper. EDIT: I have created the 3D printed enclosure. If you're interested you'll find the details here.


  1. Your article saved me a lot of time, get it running in under two hours ;-)

    1. I'm glad that the article was helpful to you. Have fun with your Squeezebox server.

  2. Hoi Eric,

    Allereerst bedankt om deze tutorial te delen.

    Ik probeer logitechmediaserver op mijn PI t installeren maar het gaat niet helemaal goed met installeren en krijg een foutmelding, hierdoor word logitechmediaplayer niet geinstalleerd op de PI.
    heb jij enig idee wat hier fout zou kunnen gaan

    pi@raspberrypi:~ $ sudo dpkg -i logitechmediaserver_all.deb
    Selecting previously unselected package logitechmediaserver.
    (Reading database ... 34777 files and directories currently installed.)
    Preparing to unpack logitechmediaserver_all.deb ...
    Unpacking logitechmediaserver (7.9.1) ...
    dpkg: dependency problems prevent configuration of logitechmediaserver:
    logitechmediaserver depends on libio-socket-ssl-perl; however:
    Package libio-socket-ssl-perl is not installed.

    dpkg: error processing package logitechmediaserver (--install):
    dependency problems - leaving unconfigured
    Processing triggers for systemd (232-25+deb9u2) ...
    Errors were encountered while processing:

  3. Het lijkt erop dat er in de laatste logitechmediaserver 7.9.1 iets is veranderd waardoor het niet goed gaat.

    1. Pascal, excuses voor de late reactie. Ik heb jouw berichten over het hoofd gezien. De foutmelding wijst op een niet geinstalleerde package: libio-socket-ssl-perl. Het eerste dat ik zou proberen is om 7.9.0 te installeren. Dat is hier te verkrijgen: Ik ben benieuwd of je de foutmelding dan nog krijgt.


Note: Only a member of this blog may post a comment.