Setting up a home music server/player on linux

For years I’ve been using Vortexbox as my music server at home. It’s basically a headless linux server configured with Logitech Music Server, an automatic CD ripper, a software player (for local sound playback) and a reasonable web interface. Vortexbox however hasn’t been updated for years. The maintainer is promising an update but I didn’t want to wait and instead set out to build my own. This is running on a HP micro-server (1.2GHz Atom) and I have Naim DAC plugged into it via USB for music.

It should be possible for anyone to install this but it is complicated and I’m not sure I’d recomend this to anyone with either no Linux experience or no desire to learn Linux.

  1. Install Lubunutu – This version comes with a GUI. I could have used one of the server versions, but the GUI is handy for the intial setup. My thought process on the distro didn’t going beyond this! I’m not going to go into detail here on the install becuase there plenty of tutorials online.

  2. Setup a user, my is phil

  3. We will also need ssh to remote login sudo apt-get install openssh-server. The rest of the set up can be done locally or now remotely via SSH.

  4. My server has 3 hard drives. One contains the OS, one is the music, one is for backup. The music files are going to be stored in the user home space rather than the root. So I edited fstab to mount my music drive in /home/phil/storage/ . Your setup may well be different. My music is held in /home/phil/storage/music/flac

  5. Install LMS (Logitech Media Server). It has a dependancy so run sudo apt-get install libio-socket-ssl-perl to install it. Download the latest version of LMS from http://www.mysqueezebox.com/. Once downloaded sudo dpkg -i logitechmediaserver_7.9.2~1530185314_amd64.deb. You will need to change the name of the .deb file for the version you downloaded. Then run sudo apt-get -f install and start the service sudo service logitechmediaserver start. You should then configure the users and group settings.

    sudo usermod -aG audio squeezeboxserver
    sudo usermod -aG lms squeezeboxserver
    sudo usermod -aG audio phil
    
  6. Create a Playlist folder somewhere and set the file group ownership to lms with sudo chown phil:lms -R Playlistand maybe sudo chmod -R 744 Playlist. The music files also need to belong to the lms group so sudo chown -R phil:lms /home/phil/storage/music/flac

  7. Open a web browser and the address will be http://[ip address of your machine]:9000. Configure LMS so that it knows the location of the music and playlist folders. Rescan the LMS music library. LMS should now be running. It’s probably not a bad idea to fix the IP address of your machine. You can normally do this with your routers web interface, or by setting the network configuration of your server (the router method is normally the easiest.)

  8. To add music to our folder over the home network we need samba to share a folder. sudo apt-get install samba, and create a samba user sudo smbpasswd -a phil. Edit the samba config sudo vi /etc/samba/smb.conf and add to the end

    [music]
    path = /home/phil/storage/music
    valid users = phil
    read only = no
    

    Restart the service with sudo service smbd restart and test the smb.conf config is valid by running testparm

  9. Install squeezelite player via the systems package manager(sudo apt-get intsall squeezelite). [Update: the repo version is rather old and seems unstable on my system. I recommend instead building from the source code. see here ].Now run squeezelite -l which should list the available audio devices. Running squeezelite from the console will start the program. If you are like me running squeezelite from the console works – it should appear as a player under the LMS webpage. ^C kills the player.

    The problem here is I would need to log in and run the command every time. It’s far better to run this as a service that starts automatically on boot. The service should be installed via the package mangager but the default configuration probably does not work. I think this is becuase the default sound card option is via pulse audio and this cannot be run as root. In the output of squeezelite -l there is (hopefully) one option starting with hw:, in my case it is hw:CARD=Audiophilleocom,DEV=0. This is the direct hardware option and it is the one we want. In /etc/default/squeezelite add the line SL_SOUNDCARD="hw:CARD=Audiophilleocom,DEV=0" or whatever your equivalent is. Restart the service with sudo service squeezelite restart and hopefully it is all working. 1

  10. Since the server is headless we don’t need to waste resources running the GUI. Switch to console login via sudo systemctl set-default multi-user.target

  11. Vortexbox automatically ripped CDs when inserted. See here for my version that uses abcde.

  12. Since I don’t log in to the machine very often via SSH, the updates can get very far behind. I’ve therefore enabled auto-update. Install with sudo apt-get install unattended-upgrades -y and sudo apt-get install update-notifier-common -y. You can then edit /etc/apt/apt.conf.d/50unattended-upgrades as you see fit. I’d recommend enabling the email notifications.

  13. On site and off site backups

1: I have had a few problems with Squeezelite crashing and I am currenlty looking into this. I suspect the pulseaudio might be the problem and it might need to be disabled. Since we aren’t using the desktop, this should be ok. Do not uninstall pulseaudio as some forums suggest. It can be disabled gobally by editting /etc/pulse/client.conf and changing the line ; autospawn = on to autospawn = off. Note the removal of the ;. My system now seems stable, however, its hard to say if it was pulseaudio or rebuilding the squeezelite from source that solved the problem. If you still have problems, it might be an idea to increase the ASLA buffersize

 

Leave a Reply

Your email address will not be published. Required fields are marked *