Monday, August 25, 2008

HOWTO: Easy music sharing (or anything else you want)

This is a quick HOWTO describing an easy setup for sharing files in a home network with no security and no headaches.

There's a popular Ubuntu Howto which uses anonymous FTP and some other stuff, with lots of downloaded scripts. I'll make everything a lot simpler for you than following that one.

Objective: To have music files served through DAAP from a server that everyone can access to add new albums to. There's no configuration on the client and very little on the server. There's no security. Anyone can change or delete files.

Procedure:
Create the directory you want to share music from.
# mkdir /home/Music

You need to install Apache 2 and ZeroConf support for it.
# tasksel install web-server
# aptitude install libapache2-mod-dnssd

Next, you need to enable the DNSSD module
# a2enmod mod-dnssd

Edit your /etc/apache2/sites-enabled/000-default file and add the following two lines to the beginning of the file:
DNSSDEnable On
DNSSDAutoRegisterVHosts On


Add this to the bottom of the file:
<Directory /home/Music>

    Options Indexes MultiViews
    AllowOverride None
    Order allow,deny
    allow from all
</Directory>

Alias /Music "/home/Music"
<Location /Music>
    DAV On
    DNSSDServiceName "Shared Music"
    DNSSDServiceTypes _webdav._tcp
</Location>


You can change the name or the directory path if you like. You can even add five or six of these definitions if you want to.
Change the shared directory to be owned by the web server so that there are no permission problems.
# chown www-data:www-data -R /home/Music

Restart the web server. Be careful. Read the output and make sure that it starts correctly.
# /etc/init.d/apache2 restart

Go to Places > Network and find your share there at the top level. You can right-click to mount it ("Connect to this server").

You're finished. No scripts to download. No hacks. Just WebDAV and Avahi.

If you want to server the Music the ZeroConf way to a client, install Tangerine (which comes with Mono and GTK ... What a waste!). I prefer mt-daapd, but it's not available in the repositories anymore.

It uses a graphical configuration client. If you don't want that (I don't), you can create a .tangerine file.

[Tangerine]
name = Shared Music
password_file = /home/Music/.tangerine-passwd
debug = False
max_users = 0
log_file = /home/Music/.tangerine-log
port = 0
publish = True
plugins = file,session
[FilePlugin]
directories = /home/Music

and then start tangerine.
$ tangerine /path/to/.tangerine

Open up your Rhythmbox and look over the music. It may take a few moments to come up.

Happy sharing!

No comments:

Post a Comment

Other I' Been to Ubuntu Stories

Related Posts with Thumbnails