Sunday, August 19, 2007

Itunes Server on Linux for OSX

I dont have a spare Mac laying around but I do have a linux box with 2 Terabytes of Disc space and I wanted to have all my MP3's online and accessible by my all the macs in the house(mine and my wifes). This is where mt-daapd comes in. Its now called firefly but all the RPM's are still mt-daapd. I built this on FC5 but it will work on any linux.

Get the RPM.
ftp://rpmfind.net/linux/sourceforge/m/mt/mt-daapd/mt-daapd-0.2.4-1.src.rpm

Extract the SRPM: rpm -Ivh mt-daapd-0.2.4-1.src.rpm
Build the RPM: rpmbuild -ba /usr/src/redhat/SPEC/mt-daapd.spec
Install the RPM: rpm -Ivh mt-daapd-0.2.4-1.rpm
Edit the config file: vi /etc/mt-daapd.conf

In this config file there are lots of options that you dont need to change. I have not been successful in getting the admin web page to work...but I dont need it.

admin_pw: set this to whatever you want.
mp3_dir: set this to the location of your MP3 archive. Mine is /storage/MP3
servername: this is what shows up in iTunes as a shared playlist. Mine is Music Jukebox
rescan_interval: how fast to check for new music. I have 400 gigs of music and it only takes a few seconds to scan the whole directory so you can make this small. Mine is set at 300

Almost there...Now if your running Avahi which comes default on FC5 then you have to modify one last file. If that service is disabled or your running the MDNSresponder you are good to go. If you are running Avahi you must edit the service file for mt-daapd.

vi /etc/rc.d/init.d/mt-daapd

under the section called start() you need to add a -m flag to the end of the line that is daemon mt-daapd. This is becuase mDNSResponder that is built into mt-daapd conflicts with Avahi.

Since I am using Avahi i need to create a service file to allow Bonjour/Rendezvous to find the share. Ensure Avahi-Daemon is running(service avahi-daemon status).
create a service file: touch daap.service
paste the following into the daap.service file.

Save the file and start the process: service mt-daapd start

<?xml version="1.0" standalone='no'?>
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>

<name>Music JukeBox</name>
<service>
<type>_daap._tcp</type>
<port>3689</port>
</service>
</service-group>


Save the file and restart Avahi: service avahi-daemon restartd

The log file should show scanning the entries and the playlist should show up in iTunes. Soon I will be working on a way to use Blue Coconut to allow copying of shared songs via iTunes. Right now you have to mount the MP3 dir and manually copy them into the local library.

No comments: