If you have ever wanted to learn about Linux, then why not try making something useful and fun. Here’s how to put together a Linux sound server. The basic configuration is a a good start for any novice trying to get under the covers of Linux and networking.
This weekend I decided I would build a headless Linux server (ie no keyboard or display). Why? because I wanted to run an old PC as a sound server and Linux is by far the cheapest way to do this. The PC is a seven-year old Hush, a 1.2 GHz Via system with 40GB hard disk and 1 GB of memory…so barely enough to run Windows.
The Hush is, in my opinion, the best-looking PC ever – it uses a fanless design, based on a mini-itx motherboard, and is housed in an aluminum case, which doubles as a heatsink. As the name suggests, it is extremely quiet and looks perfectly in place in a hi-fi rack.
“In my experience, installing a sound server on Linux is one the best ways – and also a pretty rewarding way – to improve your understanding of how computer systems work.”
Setting up Ubuntu is pretty straightforward. I chose the 10.04 LTS distribution as it’s recommended for legacy hardware. It can be downloaded as an ISO image from a Windows PC. You then burn the .iso file using a DVD writer.
On the Hush PC, all I did was pop in the newly burnt Ubuntu CD and switch on. Obviously you need a working keyboard and display to install Ubuntu and you may need to change your Bios settings to boot from CD-ROM first.
The keyboard and display can be unplugged once the operating system software is running and you have enabled remote access (see below).
The installer has several options and the Function keys should be used to set things like keyboard, language etc. At this point, make sure you select the console-only version as a graphical user interface is a bit redundant – and a big overhead – for a server that will not require a keyboard, mouse or display.
Once Ubuntu has installed and rebooted,, make sure you have network access.
Try ifconfig which will give you the IP address of the PC (such as 192.168.1.12) , then ping 192.168.1.12.
If this works try ping google.com
And finally ping another computer on your network. If anything fails at this point you’ll need to do some googling from another PC and check out Ubuntu network problem posts >>
In my case, the Ubuntu PC was unable to ping other machines on the network when it was connected directly to my wireless router, but it works perfectly when connected to a wireless bridge.
Linux is notoriously bad at wireless support – particularly on legacy gear. To overcome this, I use a D-Link DAP-1522 802.11n wireless bridge to connect the Hush PC Ubuntu machine to my LAN via an ethernet cable.
Finally is important to log into your router’s admin console and add the IP address of your new Ubuntu machine to the DHCP reserved list.
On my setup I wanted to manage the Ubuntu machine remotely. OpenSSH can be used for this. See >> http://principialabs.com/beginning-ssh-on-ubuntu/
On Ubuntu you issue the following command:
sudo apt-get install openssh-client openssh-server
I use a Windows PC running Putty (http://www.chiark.greenend.org.uk/~sgtatham/putty/) to access the Ubuntu machine remotely. So for everything needed to do, I simply logged in remotely to my Ubuntu console from Windows using Putty.
Squeezebox is a great basis for a sound server on Linux project because there is a load of open source stuff out there, which you can use instead of, or to add to, Logitech’s own excellent Squeezebox hardware like the Touch below.
Basically it’s possible to get a Squeezebox system running for free, or you can enhance an existing one with more players and controllers using an Android device as a Wi-Fi remote control and any spare PCs or laptops, to distribute music to another room. Just plug-in a pair of speakers or headphones!
Everything you need to get started can be found on the Squeezebox Wiki (http://wiki.slimdevices.com/index.php/DebianPackage)
To install the latest stable release it is necessary to update your Ubuntu /etc/apt/sources.list to include:
deb http://debian.slimdevices.com stable main
One of the great things about Squeezebox is that the Squeezebox server can be managed from any LAN computer with a web browsre. Simply type:
http:[enter the IP address of the ubuntu server here eg 192.168.1.12]: 9000
So in my configuration I use the following address in Firefox: http://192.168.1.139:9000
In my setup I wanted the music files to be stored n a NAS drive. This requires Samba. Here is a great explanation of how to mount a NAS server at boot time using Samba >> (http://ubuntuforums.org/showthread.php?t=280473)
If all you want is a Squeezebox server then that’s it.
But I also wanted to use the Ubuntu box to play music as well…
Getting Sound working
This is why people hate Linux. Sound can very tricky. From my own experience, plenty of Googling “Alsa“, finally gave me what I needed – basically the alsa-base, alsa-lib and alsa-utils Ubuntu packages need to be installed and configured. There are many variations of things that can go wrong. See the Ubuntu Sound Trouble Shooting Guide here >>
I eventually got sound out of the Ubuntu box – but be warned, this was quite traumatic.
There are plenty of Squeezebox clients, like SoftSqueeze, a Java client and SqueezePlay a native Squeezebox player. But these rely on the Gnome desktop GUI. For a text-only player, there’s SqueezeSlave.
Now this is what open source is all about…to get SqueezeSlave working it is necessary to compile it for your system. This is not as bad as it sounds
First you need to install the various utilities require for compiling:
sudo aptitude install build-essential
A guide to getting it installed can be found on the SqueezeSlave Wiki here >>
sudo apt-get install subversion
sudo apt-get install libasound2-dev
sudo apt-get install libncurses5-dev
sudo apt-get install liblircclient-dev
svn checkout http://squeezeslave.googlecode.com/svn/squeezeslave/trunk/squeezeslave
make -f makefile.linux26-alsa-display realclean
make -f makefile.linux26-alsa-display
You will need also to install LAME. Here’s how to do it >>
There is a good set of tips on making sure Squeezeslave is working and it also shows how to start Squeezeslave at boot time at http://forums.slimdevices.com/showthread.php?t=79526
If you have installed the console-only version of Ubuntu, you may need have difficulty hearing any audio from the root user (which runs when the machine starts up).
I added root to the audio group. See: http://www.brunolinux.com/02-The_Terminal/The_Groups_Command.html
You will also need to make sure the volume works (my setup uses the SPDIF output, which, strangely I had to mute to hear sound using sudo alsamixer!). Here’s a pic of the Android Squeezebox controller on a Sony X10 Pro. This software can be downloaded for free from the Android Marketplace.
Once it is going
You can try a wealth of the Squeezebox plug-ins such as the great BBC iPlayer plug-in. One of the most useful ones I have discovered is svrpowercontrol, which lets you power down the server.