Running Linux as an iTunes music server

Last night I finally got around to consolidating the household music collection and making it available to all the personal computers on our network.

I had originally shared my music on the network from my Mac, but this only worked when I was logged in and when iTunes was running. When Cat was logged in on the same machine, she didn’t have access to our music collection in my home directory.

Even if we were able to somehow share a music folder, one of us would need to remain logged in with iTunes running for any other clients on the network to have access to the library.

Fortunately, my CentOS Linux server had already been configured to backup the Mac’s iTunes music collection nightly via rsync, so it had its own mirror of what was on the Mac. I just needed to find a way to make that library available to all the Mac and PC users on my network as an iTunes share.

I discovered several approaches on the Web, but came up with a solution with a bit of custom configuration based on several resources. Now, whatever is ripped to or bought via the iTunes Music Store on the Mac is made available to all users via Apple RendezVous/Bonjour using the DAAP protocol implemented by Firefly Media Server (mt-daapd) on the local subnet.

In the steps below, corresponds to the CentOS 4.4 x86_64 Linux server, is the Mac OS X 10.4.8 running iTunes 7.0.2.

  • First, here is the nightly rsync line configured to run on the Linux server. I use keys to run the script over SSH.
    [code lang=”bash”]
    [dan@]$ vi
    rsync -av -e “ssh -i /home/dan/rsync-key” \\”/Users/dan/Music/iTunes/iTunes Music/’\’ /home/dan/iTunes[/code]
  • Install the libid3tag RPMs so that the Linux server can interpret music file metadata.
    [code lang=”bash”]
    [root@]# rpm -i libid3tag-0.15.1b-3.2.el4.rf.x86_64.rpm
    [root@]# rpm -i libid3tag-devel-0.15.1b-3.2.el4.rf.x86_64.rpm[/code]
  • Build the mt-daapd daemon from source, since there was no RPM for my platform.
    [code lang=”bash”]
    [root@]# tar xvzf mt-daapd-0.2.4.tar.gz
    [root@]# cd mt-daapd-0.2.4
    [root@]# ./configure –prefix=/usr/local
    [root@]# make
    [root@]# make install[/code]
  • Copy some example configuration files from the distribution.
    [code lang=”bash”]
    [root@]# cp contrib/mt-daapd.conf /etc
    [root@]# cp contrib/mt-daapd.playlist /etc[/code]
  • Change the default configuration.
    [code lang=”bash”]
    [root@]# vi /etc/mt-daapd.conf
    web_root /usr/local/share/mt-daapd/admin-root
    port 3689
    admin_pw admin-pw
    db_dir /var/cache/mt-daapd
    mp3_dir /home/dan/iTunes/
    servername centos
    runas dan
    playlist /etc/mt-daapd.playlist
    extensions .mp3,.m4a,.m4p,.ogg
    logfile /var/log/mt-daapd.log
    rescan_interval 300
    compress 1[/code]
  • Perform some initial setup, which shouldn’t be necessary if you are installing mt-daapd from an RPM instead of source.
    [code lang=”bash”]
    [root@]# mkdir -p /var/cache/mt-daapd
    [root@]# cp contrib/mt-daapd /etc/init.d
    [root@]# vi /etc/init.d/mt-daapd # Make some path changes for my environment
    [root@]# chmod +x /etc/init.dmt-daapd
    [root@]# /sbin/chkconfig –add mt-daapd # Configure mt-daapd to run at startup
    [root@]# chmod o+r -R iTunes # Allow the daemon to read the audio files in my home directory, in case it’s not running as me.
    [root@]# /etc/init.d/mt-daapd start[/code]
  • With that, the share was now available to the PCs and Macs on my network. To debug any other issues, I tailed the log.
    [code lang=”bash”][root@]# tail -500f /var/log/mt-daapd.log[/code]

That was basically it. I’m still working on customizing things further, and I still keep a local copy of my music on the Mac to synchronize with my iPod.

Here’s a list of resources I consulted to get things going. Google Linux iTunes Server for more.

Broadband I can live with

At last, I am free of DSL hell. I’ve moved to a new house, and now have a cable broadband connection for the first time.

The package I got is faster than the standard cable offering and, most importantly, doesn’t block ports so I can continue to host my own mail and Web servers (which is the reason I’ve had to put up with DSL for so long). If you live in the Cablevision service area, do yourself a favor and check out Optimum Online Boost.

I’ve moved the remainder of my sites over to the server at home now, including this blog and the Civet Networks site. Good times for all (as long as the paint fumes, sawdust, cat hair and frost don’t get to the machine before you do).

DSL sucks

04 November 2005 » Network administration

Yet another DSL update. I woke up Monday morning to find that my connection was out. Turns out somewhere along the line the phone company decided that I had submitted a cancellation of service order and removed my brand new connection at the central office. It took 4 days to find that piece of information out, and now I have to wait till November 9th for a new connection. Awesome.

Smooth transition

23 October 2005 » Network administration

Well, I suppose I’ll have to recant my earlier entry. I’m now in the new apartment with my Speakeasy DSL successfully transferred over and two days ahead of schedule. My router needed no new settings, and the static IP address remained the same. So all I had to do to get the sites below back on line was plug in the DSL modem, connect the router, and fire up my eServer (sans keyboard, mouse, and monitor).

DSL migration ahead

17 October 2005 » Network administration

It’s that time again. I’m moving and that means yet another transfer of my DSL service from one apartment to another. At least I know what to expect, though that never has eased the experience of the previous 4 times I’ve awaited DSL activation. I have abandoned hope. Expect,,, and others to be down till at least November to be on the safe side. $@#!.

Hosting at home

Thanks to, I have been able to open my home Dynamic IP DSL LAN to the Internet. I’ll soon have my dedicated Solaris 9 box on-line to serve pages (Solaris 8 has so far been a pain to configure…). In the meantime you can check out the fantastic pages currently served up by Mac OS X and by Solaris.

Bad router?

For some reason I’m having trouble FTPing to this site from home. I think it has something to do with packet checking by my host’s new Sun Solaris server on the data coming from computers behind my firewall. This may not bode well for my own Sun machine which I’ve been intending to use as a PHP/JSP/PostgreSQL staging server once I upgrade to static IP DSL.