Quantcast
Channel: Squeezebox : Community : Forums - Linux / Unix
Viewing all articles
Browse latest Browse all 1518

HOWTO: Install squeezelite for logitech media server on Debian Squeeze as a service.

$
0
0
I have been looking for a way to run a headless linux squeezebox player on a mini PC for a while and thought this howto might be useful for others. Squeezeplay and squeezeslave were always problematic for me. I recently gave squeezelite a try and it has been very successful.

The only caveat is that once in a while I get a popping sound but it is very rare and usually occurs when switching tracks. Otherwise, I have tested this using my music collection, Pandora, Spotify etc with no issues. Multi-room is working good as well with no issues.

I have 4 Zotac ZBOX mini PCs with various AMD and Intel processors. I was able to set all of them up the same way with no problems. ZBOX info here: http://www.zotac.com/products/mini-p.../mini-pcs.html

I used Debian Squeeze for all the installs. 64 bit net install image. I won't go into detail about installing Debian as there are plenty of guides out there. The important part during the install is that you do not select the Graphical User Interface and instead install on the base system and SSH server. Debian will ask you to setup a user as well, and this is the user we will use to run squeezelite, so name accordingly. I was also able to easily configure wireless using the Debian guide.

Debian net install: http://www.debian.org/distrib/netinst
Debian wireless command line: http://wiki.debian.org/WiFi/HowToUse#Command_Line

The rest of this howto assumes you have a working base Debian install with SSH access and you are logged in as root.

Debian Linux 6 comes with the Linux kernel version 2.6.x only. However, you can install the Linux kernel version 3.2.x using backports. This step may or may not be necessary but I would generally recommend it as 3.2.x has much better hardware support.

Edit /etc/apt/sources.list, run:
Code:

# vi /etc/apt/sources.list
Append the following line:
Code:

deb http://backports.debian.org/debian-backports squeeze-backports main
Install the linux kernel 3.x.xx

Type the following command to search kernel image:
Code:

# apt-cache search linux-image-3
Sample output:
Code:

linux-headers-3.2.0-0.bpo.4-amd64 - Header files for Linux 3.2.0-0.bpo.4-amd64
linux-headers-3.2.0-0.bpo.4-rt-amd64 - Header files for Linux 3.2.0-0.bpo.4-rt-amd64
linux-image-3.2.0-0.bpo.4-amd64-dbg - Debugging symbols for Linux 3.2.0-0.bpo.4-amd64
linux-image-3.2.0-0.bpo.4-amd64 - Linux 3.2 for 64-bit PCs
linux-image-3.2.0-0.bpo.4-rt-amd64-dbg - Debugging symbols for Linux 3.2.0-0.bpo.4-rt-amd64
linux-image-3.2.0-0.bpo.4-rt-amd64 - Linux 3.2 for 64-bit PCs, PREEMPT_RT

Code:

# apt-get -t squeeze-backports install linux-image-3.2.0-0.bpo.4-amd64 firmware-linux-free
At this point, reboot and make sure everything is working

The next step is to install alsa, the linux sound driver system.
Code:

# apt-get install alsa
You can then see what devices it found with

Code:

# aplay -l
I had no issues here and my soundcards required no additional setup

Next we install git, a distributed revision control and source code management system so we can download the latest squeezeslave source code

Code:

# apt-get install git
Next we install some developer libraries needed to build squeezelite

Code:

# apt-get install build-essential libasound2-dev libflac-dev libmad0-dev libvorbis-dev libvo-aacenc-dev libfaad-dev libmpg123-dev
Change to the /opt directory to clone the source code. /opt is for optional software that isn't part of the package management system, generally.

Code:

# cd /opt
Clone the source code
Code:

# git clone https://code.google.com/p/squeezelite/
Change to the squeezelite directory
Code:

# cd /opt/squeezelite
Compile the source
Code:

# make
Next, we need to find the correct output device so that squeezelite will output to your device of choice. Make note of this we will need it for the init file.

Code:

#./squeezelite -l
Sample output:
Code:

Output devices:
  null                          - Discard all samples (playback) or generate zero samples (capture)
  default:CARD=SB                - HDA ATI SB, ALC888 Analog - Default Audio Device
  front:CARD=SB,DEV=0            - HDA ATI SB, ALC888 Analog - Front speakers
  surround40:CARD=SB,DEV=0      - HDA ATI SB, ALC888 Analog - 4.0 Surround output to Front and Rear speakers
  surround41:CARD=SB,DEV=0      - HDA ATI SB, ALC888 Analog - 4.1 Surround output to Front, Rear and Subwoofer speakers
  surround50:CARD=SB,DEV=0      - HDA ATI SB, ALC888 Analog - 5.0 Surround output to Front, Center and Rear speakers
  surround51:CARD=SB,DEV=0      - HDA ATI SB, ALC888 Analog - 5.1 Surround output to Front, Center, Rear and Subwoofer speakers
  surround71:CARD=SB,DEV=0      - HDA ATI SB, ALC888 Analog - 7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
  iec958:CARD=SB,DEV=0          - HDA ATI SB, ALC888 Digital - IEC958 (S/PDIF) Digital Audio Output
  hdmi:CARD=HDMI                - HDA ATI HDMI, HDMI 0 - HDMI Audio Output


Next we edit the init file so we can start up squeezelite on boot.

Code:

# vi /etc/init.d/squeezelite

Copy and paste this into /etc/init.d/squeezelite. Make sure you change the variables. USER should be the user you created when you installed Debian. OUTPUT is the device we found earlier with ./squeezelite -l. NAME can be whatever you like. LMS is the IP address of your logitech media server.

Code:

#!/bin/sh
### BEGIN INIT INFO
# Provides:          squeezelite
# Required-Start:    $syslog
# Required-Stop:    $syslog
# Default-Start:    2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Script to start squeezelite
# Description:      Service script for squeezelite, command line squeezebox player
### END INIT INFO
#Define some variables.  LMS is the IP of your Logitech Media Server.  Output device can be found by running squeezelite -l

USER=someuser
OUTPUT=iec958:CARD=SB,DEV=0 
NAME=SqueezelitePlayerName
LMS=192.168.x.x

case "$1" in
  start)
    echo "Starting Squeezelite"
    start-stop-daemon --start --quiet -b -m -p /var/run/squeezelite.pid --chuid $USER --exec /opt/squeezelite/squeezelite -- -z -o $OUTPUT -n $NAME $LMS
  ;;
  stop)
    echo "Stopping Squeezelite"
    start-stop-daemon --stop --quiet --pidfile /var/run/squeezelite.pid
    rm -f /var/run/squeezelite
  ;;
  *)
    echo "Usage: /etc/init.d/squeezelite {start|stop}"
    exit 1
  ;;
esac
exit 0

Next, change the init to be executable with
Code:

# chmod +X /etc/init.d/squeezelite
Then start squeezelite
Code:

# /etc/init.d/squeezelite start
The player should show up in your logitech media server. Give it a test play.
The last step is to add the script to boot with:

Code:

# insserv squeezelite
Thats it! Let me know if you run into any problems.

Viewing all articles
Browse latest Browse all 1518

Trending Articles