Go Back   Sonos Forums > The Unsupported Area

Reply
 
Thread Tools Display Modes
  #1  
Old Jun 9th, 2009, 01:32 PM
dougalf dougalf is offline
Member
 
Join Date: Jun 2009
Location: Amsterdam
Posts: 3
Default Sonos with Linux detailed Howto

Sonos without Windows
I have a Linux server running Debian, a close relation of Ubuntu and a laptop running Ubuntu. I bought a Sonos ZP90 but not the controller. I found various bits and pieces on the internet on how to get this working but no complete howto so I thought it would be useful to others if I created a detailed guide for Google to find :-)

Physical set-up
The Sonos and server are connected to my ADSL modem with ethernet cables. The laptop connects via wireless.

Sharing the music
On the server create a new users sonos
Code:
sudo adduser sonos
sudo passwd sonos
and enter a new password.
Check that user sonos can read your music files
Code:
su - sonos
cd <wherever you have your music>
ls
cd <some folder>
ls
exit
check you have Samba installed
Code:
dpkg --get-selections | grep samba
If you have it returns
Code:
samba-common                                   install
If not install it with
Code:
sudo apt-get install samba
Back up the config
Code:
sudo mv /etc/samba/smb.conf /etc/samba/smb.conf.orig
then create /etc/samba/smb.conf to look like this
Code:
[global]
workgroup = server
netbios name = server
server string = Samba Server %v
load printers = no
log file = /var/log/samba/log.%m
max log size = 50
socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192
interfaces = lo eth0
security = user
password level = 12
username level = 12
encrypt passwords = yes
username map = /etc/samba/smbusers

[musicshare]
path = <wherever you have your music>
valid users = sonos
read only = yes
printable = no
only guest = no
and create a samba users file /etc/samba/smbusers
to look like this
Code:
root = administrator admin
nobody = guest pcguest smbguest
sonos = sonos
This next is a new feature for Samba that some of the older howto's didn't need:
Code:
sudo smbpasswd -a sonos
and enter a password. This is the one you will use below during the Sonos set-up.

Restart samba to use the new config
Code:
sudo /etc/init.d/samba restart
Check it's working
Code:
sudo vi /var/log/samba/log.?mbd
Tell Sonos about the music

On the laptop, install Wine
Code:
sudo apt-get install wine
Insert the Sonos installation CD, open it with file browser. Right click on setup.exe and choose "open with Wine Windows Program Loader". Follow the usual install instructions. (If the application can't find your Sonos device then try connecting the laptop to your network using an ethernet cable and turn off your wireless connection. This is only necessary for the initial discovery steps.) On the "select music source" page choose "add music stored in folders that are currently shared on my network".
  1. Path: \\server\musicshare (replace "server" with the hostname of your server)
  2. User name: sonos
  3. Password: whatever you typed at the smbpasswd command above
and you should be in business. If not you might get some useful debug from the error message that Sonos gives you.

Web interface

At this point you should be able to play music using the Sonos controller on the laptop running under Wine. However if you have multiple users on your laptop you will have to install it for each of them. For this reason or just because you prefer a web interface you can install the lovely software Sonos web controller.

On the server
Code:
wget http://www.purple.org/sonos/sonosweb-0.72.tar.gz
(check that there hasn't been a new release)
Code:
tar -xzf sonosweb-0.72.tar.gz
cd sonos
./sonos.pl -config
I you get an error about
Code:
Can't locate SOAP/Lite.pm in @INC
then you need to
Code:
sudo perl -MCPAN -e "install Data::Dumper"
sudo perl -MCPAN -e "install SOAP::Lite"
sudo perl -MCPAN -e "install LWP::UserAgent"
sudo perl -MCPAN -e "install HTTP::Daemon"
sudo perl -MCPAN -e "install XML::Simple"
sudo perl -MCPAN -e "install HTML::Template"l
which takes a while. Ignore any errors you might get.
For sonos config select the defaults apart from "location on local disk that Sonos indexes" which you should change to point to where you have your music. Install the software
Code:
sudo mv sonos /usr/local/share
And now prepare to run it in the background
Code:
screen
cd /usr/local/share/sonos
./sonos.pl
If it starts happily then you can do "ctrl-a d" (ie press control and the "a" button at the same time then just the "d" button) to detach from the session and leave it running. To come back to it use
Code:
screen -r
On the laptop you should now be able to point a browser at http://server:8001 and away you go!

Good luck,
Dougal

Last edited by dougalf; Jun 19th, 2010 at 01:52 AM. Reason: Changed install of Perl UPnP from Ubuntu to CPAN
Reply With Quote
  #2  
Old Jun 10th, 2009, 03:20 AM
ianmacd's Avatar
ianmacd ianmacd is offline
Member
 
Join Date: Apr 2007
Location: Amsterdam, The Netherlands
Posts: 514
Default

Quote:
Originally Posted by dougalf View Post
Sonos without Windows
I have a Linux server running Debian, a close relation of Ubuntu and a laptop running Ubuntu. I bought a Sonos ZP90 but not the controller. I found various bits and pieces on the internet on how to get this working but no complete howto so I thought it would be useful to others if I created a detailed guide for Google to find
Note that you can also run the Windows desktop controller with WINE. It works for 95% of the functionality.

What we really need is a cross-platform controller, of course.
__________________
Ian Macdonald
10 zones: 6 x ZP100, 1 x ZP120, 1 x ZP90, 2 x S5,
4 x CR100 and 2 x CR200
(+ 2 x ACR & pre-3.7 PC DCR on Linux WINE)

To view links or images in signatures your post count must be 4 or greater. You currently have 0 posts.
Reply With Quote
  #3  
Old Jan 4th, 2010, 06:35 AM
Anden100 Anden100 is offline
Member
 
Join Date: Jun 2009
Posts: 7
Default

If you are using ubuntu, do the following:

Install Wine (a guide can be found on the official Wine homepage, google)
Download the Sonos setup file from the main side (what to buy->Controllers->Sonos Desktop Controller for Windows->Download)
Double click the file you downloaded and the install wizard will show
As soon as it is needed, Sonos will prompt you that you need Samba, Ubuntu will guide you through the settings, and you will avoid the need of a password

alot easier, since you completely avoid to use the Console :P
Reply With Quote
  #4  
Old Jan 4th, 2010, 11:31 PM
hippysoyboy hippysoyboy is offline
Member
 
Join Date: Jul 2007
Location: Melbourne, Australia
Posts: 53
Default

Quote:
Originally Posted by ianmacd View Post
What we really need is a cross-platform controller, of course.
There is a java-based controller than runs on Linux, but it's feature set is quite small, and I haven't had time to work on it much recently...

http://forums.sonos.com/showthread.php?t=10499
Reply With Quote
  #5  
Old May 14th, 2010, 06:47 AM
licenced licenced is offline
Member
 
Join Date: May 2010
Location: UK
Posts: 73
Default

I tried the java-based controller on my wife's Ubuntu laptop. It just about worked, but was very sluggish and took multiple double-click and button clicks to get it to play.

I also tried the perl sonosweb solution - before realising that it has to be running on the same box as the music resides (my MP3s are on a Buffalo NAS).

The WINE + Sonos Desktop Controller solution is perfect and works without the hassle of having to configure scripts etc.

Dave
Reply With Quote
  #6  
Old May 14th, 2010, 02:32 PM
ianmacd's Avatar
ianmacd ianmacd is offline
Member
 
Join Date: Apr 2007
Location: Amsterdam, The Netherlands
Posts: 514
Default

Quote:
Originally Posted by licenced View Post
I also tried the perl sonosweb solution - before realising that it has to be running on the same box as the music resides (my MP3s are on a Buffalo NAS).
Actually, it doesn't have to be on the same box.

My music is also on a NAS and I used to run sonosweb on a separate machine.
__________________
Ian Macdonald
10 zones: 6 x ZP100, 1 x ZP120, 1 x ZP90, 2 x S5,
4 x CR100 and 2 x CR200
(+ 2 x ACR & pre-3.7 PC DCR on Linux WINE)

To view links or images in signatures your post count must be 4 or greater. You currently have 0 posts.
Reply With Quote
  #7  
Old May 15th, 2010, 07:34 AM
licenced licenced is offline
Member
 
Join Date: May 2010
Location: UK
Posts: 73
Default

Quote:
Originally Posted by ianmacd View Post
Actually, it doesn't have to be on the same box.

My music is also on a NAS and I used to run sonosweb on a separate machine.
I think I misunderstood.

I'm not very familiar with Linux - during the config of SonosWeb it asks for the directory where the music is so it can index it. I tried putting in the location, which is a samba share, so 'smb://music', but it said that wasn't a directory.

I tried various ways of mounting the location into a normal directory path, and although that seemed to work, SonosWeb still wouldn't do its thing.

Using WINE and SONOS Desktop Controller just worked straight away.

Dave
Reply With Quote
  #8  
Old May 15th, 2010, 09:28 AM
Majik's Avatar
Majik Majik is offline
Moderator
 
Join Date: Mar 2005
Location: Berkshire, UK
Posts: 6,181
Default

The Sonosweb app has it's uses, but for a desktop environment, the Sonos native Desktop Controller is far better.

Great you hear you got it working!

Cheers,

Keith
__________________
Sonos customer (6 x ZP100, 1 x ZP120, 1 x ZP90, 4 x PLAY:5, 2 x PLAY:3, 5 x CR100, 1 x CR200, 2 x SUB, 1 x Playbar)
I am not affiliated with or representative of Sonos in any way. All opinions expressed are my own!
Reply With Quote
  #9  
Old Jun 8th, 2010, 01:06 AM
Snille's Avatar
Snille Snille is offline
Member
 
Join Date: Feb 2010
Location: Enköping, Sweden
Posts: 8
Default

Hi dougalf,
I hope you still develop a bit on this one...
I'm trying to run your perlscript on one of my servers. After some smaller installation problems I got it to run. But it exists all the time with this error message: "Can't use string ("1") as an ARRAY ref while "strict refs" in use at ./sonos.pl line 1798.". I have tried different "skins" but it is the same error message for most of them. However the simplest skins seams to work...

I hope this makes sense and that you still work on this nice scripts...
__________________
//Snille - If you can't find it, make it and share it!
11 Zones - 1 x Play:3, 2 x Play:5, 3 x Connect, 5 x Connect:AMP, 3 x CR200...
Reply With Quote
  #10  
Old Jun 19th, 2010, 10:45 AM
dougalf dougalf is offline
Member
 
Join Date: Jun 2009
Location: Amsterdam
Posts: 3
Default

Sorry Snille I've just followed my own HOWTO and I get the same problem as you. I'm very embarrassed. I've fixed the post now but it may be too late for you to recover :-( I think the problem is that Purple (which I didn't write by the way!) relies on the CPAN rather than the Ubuntu Perl libraries. I patched it up a little by
Code:
sudo apt-get remove libsoap-lite-perl libxml-simple-perl
then do it properly
Code:
sudo perl -MCPAN -e "install Data::Dumper"
sudo perl -MCPAN -e "install SOAP::Lite"
sudo perl -MCPAN -e "install LWP::UserAgent"
sudo perl -MCPAN -e "install HTTP::Daemon"
sudo perl -MCPAN -e "install XML::Simple"
sudo perl -MCPAN -e "install HTML::Template"l
It takes some time and might give some errors which I just ignored.
It's not perfect because the playlist isn't displayed even though it works fine. I think that the Ubuntu install pulled in some extra perl dependencies but I can't figure out what they are now. I hope you can get this far and that it's good enough for you?

Alternatively you could do
Code:
sudo apt-get install mediatomb
I don't remember doing any config. This turns your music into a UPnP media source. The Sonos box is already a media player so all you need is a controller. If you have a Nokia n900 then Zhaan works well although I don't find it as handy for searching as Purple. Perhaps you can find another UPnP controller in the Ubuntu repositories? I'm afraid I don't have time to experiment at the moment.

I know that the person behind Purple used to visit these forums, I don't know if you can get their attention and ask for their help in patching your Perl install....?

Good luck and sorry again,
cheers,
Dougal
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 01:14 PM.