Search:  
Gentoo Wiki

HOWTO_Slimserver


This article is part of the HOWTO series.
Installation Kernel & Hardware Networks Portage Software System X Server Gaming Non-x86 Emulators Misc
Wikipedia has an article on:
SlimServer

Contents

Introduction

Note: There is now an updated ebuild for SqueezeCenter version 7 available as media-sound/squeezecenter in the official Portage tree. This ebuild significantly simplifies these instructions, and these instructions should probably be updated.

This is all about getting music, conveniently and at high quality, to where you want it. The music comes from either (a) your own library of digitised music on a computer of your own or (b) a wide variety of internet radio sources. It will typically go to one of the Squeezebox family of hardware players from SlimDevices, although you can also use a variety of software players such as SoftSqueeze.

A common setup is to have a normal home computer (Windows, Linux or Mac), with an internet connection, the SlimServer software and a collection of music stored on its disc. This computer is then connected by a Network to a Squeezebox, which plugs into your normal home audio system (as if it were a CD player, say).

You can then play any of your music library - making your choice either through a web-based interface on your computer, or through a remote control pointed at the Squeezebox.

For information on Slimserver software see SlimServer Info For more information see General Slim Devices website.

I think this setup is very useful for listening to your collection at your laptop in the garden, at work, at (usually) poorly equipped parties or on your wi-fi enabled linux phone. You may want to consider tunneling the stream through ssh to prevent eves.

Automatic Installation

There is a ebuild available (for 6.5.4) and the only thing to do is add the 'x86' keyword to unmask the package (it is considered unstable). Also, there is a dependency of an unstable perl package. I had to unmask them:

/etc/portage/package.keywords:

media-sound/slimserver ~x86
dev-perl/YAML-Syck ~x86

In case you want to be able to stream .ogg files (if your collection includes ogg files), then you should add the ogg use flag. I also added encode and musepack.

then do:

# emerge -av slimserver

to start the slimserver (no configuration is needed), just type

# /etc/init.de/slimserver start

and you'll be able to point a browser to

http://<ip address of server>:9000/ (use localhost if you have X on the machine).

which allows you to scan your collection. If it doesn't work, review your permissions, Slimserver creates a user slimserver which must be able to access your files. At this point you cannot start playing, because no clients are connected. You'll see No Player found at the right hand side. You have to connect a client to the stream before, point your favorite playback program to

$ mplayer http://<ip address>:9000/stream.mp3 (on windows use winamp for example)

but you won't hear anything. However you can now configure a playlist for the client and press play at the web interface in your browser. Neat. I found it useful to protect the webinterface (and the stream) with a password. This can be configured with the webinterface. For playback, you should now use this syntax:

mplayer http://<username>:<password>@<ip-address>:9000/stream.mp3

however, there is a better way to protect your files from unauthorized access: SSH tunnel.

SSH tunnel your music

If you want to listen to your files at work or on a wi-fi mobile, you have to expose your server port (9000 by default) to the outside world. Which is uncomfortable as it is a security leak (yes, check the logs and you'll see predators). Think about surfing on a public wi-fi spot. I personally prefer to expose only the SSH port (moved to a non-default (22) port like 24511) to the world.

to create a tunnel to your server, just execute:

$ ssh -p24511 -fN <login-name>@<www-ip> -L 7000/localhost/9000

where

Now check out http://localhost:7000 (on the client) and you'll find your usual browser interface. To playback your collection, execute:

$ mplayer http://localhost:7000/stream.mp3

I put these two commands together in a script called secureStream.

Has anybody a suggestion for also streaming music on windows boxes in a secure way (poor-party-setup)? Did anybody try putty for this purpose?

Manual Install SlimServer

There is an ebuild (see Automatic Installation) now, no need for the instructions below unless you run into problems.

The following commands will need to be ran as root or under sudo with root permission.

First you need to get the Slimserver package.

wget http://www.slimdevices.com/mint/pepper/orderedlist/downloads/download.php?file=http%3A//www.slimdevices.com/downloads/SlimServer_v6.5.0/SlimServer_v6.5.0.tar.gz 

After the download is finished, you will have to unpack it to its default location (/usr/local/slimserver)

mkdir /usr/local/slimserver
tar xvzf SlimServer_v6.5.0.tar.gz -C /usr/local/slimserver

For SlimServer 6.5, Perl 5.8.1 is the minimum required version. Depending what use variables are set, other packages are required.

aac -> media-libs/faad2
alac -> media-sound/alac_decoder
encode -> media-sound/lame
ffmpeg -> media-video/ffmpeg
flac -> media-libs/flac
ogg -> media-sound/sox
musepack -> media-sound/musepack-tools
shorten -> media-sound/shorten

If you have any of these use flags, make sure the corisponding package is installed.

Now we have to make sure we have all the perl modules used by SlimServer.

/usr/local/slimserver/Bin/build-perl-modules.pl

You will then be asked where you perl install is, if you hit enter it will take the default, which should be your default install location for Perl. Next it will ask you for SlimServer directory, which we put it in the default location, so just hit enter. Finally it will ask you were you want it to download the files to, I just choose /tmp, but feel free to pick whatever you want. It will now download, build and install the Perl modules that are needed for SlimServer.

We now have to setup the slimserver group and user.

groupadd slimserver
useradd -g slimserver -s /bin/false slimserver

We now have to create and setup directories and files.

touch /etc/slimserver.prefs
mkdir /var/log/slimserver /var/cache/slimserver /var/run/slimserver
chown slimserver:slimserver /var/log/slimserver /var/cache/slimserver /var/run/slimserver /etc/slimserver.prefs

To wrap up this installation, we need to create the init.d and conf.d files.

File: /etc/init.d/slimserver
#!/sbin/runscript

# Init script for SlimServer 5/6 for Gentoo Linux
# Save this as /etc/init.d/slimserver.
# Don
# Don't forget to issue 'rc-update add slimserver default' to
# have it restart at boot time. Remember to add user to system.
# David

depend() {
	need net
	after localmount
}

# Configure these appropriately for the local installation
pidfile=/var/run/slimserver/slimserver.pid
logfile=/var/log/slimserver/messages
ssdir=/usr/local/slimserver
cachedir=/var/cache/slimserver
niceness=-10

start() {
	ebegin "Starting Slimserver"
	
	HOME=${ssdir} /bin/nice --adjustment=${niceness} start-stop-daemon \
		--start --quiet \
		--exec ${ssdir}/slimserver.pl -- --daemon \
		--prefsfile=/etc/slimserver.pref --cachedir=${cachedir} \
		--pidfile=${pidfile} --user=slimserver \
		--logfile=${logfile} ${SLIMSERVER_OPTS}
	eend $? "Failed to start Slimserver"
}

stop() {
	ebegin "Stopping Slimserver"
	start-stop-daemon --stop --quiet --pidfile ${pidfile}
        # In the case of misconfiguration use linux's 'killall'.
        killall slimserver.pl
	eend $? "Failed to stop Slimserver"
}
File: /etc/conf.d/slimserver
# Configuration file for SlimServer 5/6 on Gentoo Linux.
# Save this as /etc/conf.d/slimserver

# Enter space-deliminated options on the following line.
# See "slimserver.pl --help" for a full list of possible options.
SLIMSERVER_OPTS="--d_scan"

Finally, it is time to run and test SlimServer, but first we need to make it excutable.

chmod +x /etc/init.d/slimserver
/etc/init.d/slimserver start

If all goes according to plan, SlimServer will start. To test it, point out your browser to http://127.0.0.1:9000 (or whatever the IP address is).

Retrieved from "http://www.gentoo-wiki.info/HOWTO_Slimserver"

Last modified: Fri, 05 Sep 2008 06:28:00 +0000 Hits: 2,764