Sharing music from Linux to iTunes

Update 2009-02-07: These are instructions for Sarge. See comments if you’re using Etch or above.

Yesterday while writing my thesis in the library, I was listening to some other person’s music she had shared through iTunes. It’s a nice feature they’ve got there, so it got me tinking “could I make my Linux server at home share my whole music collection like an iTunes share?”.

After some quick Googling I found out that it’s actually possible and the software is already out there. Just to compile and install. However, the instructions I found was either not verbose enough or not applicable on my setup.

On-the-fly-comment: Now I suddenly found out that there’s a project called firefly that replaces the daapd that I’ve been using here. This information makes this post almost completely useless, but I’ll go on anyway, skipping the part about compiling and hacking daapd.

So this was the scenario: I’ve got all my mp3s on my Linux server, which I usually mount to my desktop machine (also Linux). I can’t bother mounting the share on my MacBook (since I’d have to import the whole library into iTunes’ database and I don’t want that), but instead it would be nice to have the library accessible as an iTunes share. This is how I got it working.

Disclaimer: If this fucks up your computer, it’s your problem.

In my setup (debian Sarge) I need two components to get it running: firefly (formerly mt-daapd) and mDNSResponder from Apple’s Rendezvous suite (nowadays Bonjour). The latter makes your Linux computer show up as a shared library in iTunes, and the former actually streams the music.

  • Download the source for the Rendezvous suite from Apples site. You’ll need to register.
  • Unpack it
    tar -xzvf Rendezvous.tar.gz
  • Enter the subdirectory mDNSPosix
    cd mDNSResponder*/mDNSPosix
  • Compile with the appropriate flag
    make os=linux

Normally, this is where you say ‘make install’ or ‘checkinstall’ or something like that. If you do that, you’ll install the mdnsd daemon, which is totally unnecessary for our purpose, so we’ll just skip that. Instead, take a look in the build directory and its subdirectories. You should find a binary called mDNSResponderPosix. This is what we need.

  • Copy the binary to some suitable bin directory (and modify your path if needed)
    cp mDNSResponderPosix /usr/local/bin
  • Create a config file /etc/mdnsresponder.conf with the following contents (modifying the first line to something appropriate for your particular share)
    Marvin's JukeBox
  • Download my init.d script and save it as /etc/init.d/mdnsresponder

That was the first part. Now you should be able so say (as root) ‘/etc/init.d/mdnsresponder start’ to get your machine visible in iTunes. There are still no songs to browse though.

Next, download firefly. If you’re lazy like me, then look for the most recent .deb package in the version tree and save that on your Linux machine.

  • Install the .deb you just downloaded (as root)
    dpkg -i mt-daapd_*.deb
  • Edit the config file to suit your needs (it’s well commented)
    emacs /etc/mt-daapd.conf
  • Then just fire up the daemon with the supplied init.d script (as root)
    /etc/init.d/mt-daapd start

Now, if you’re lucky and have edited the config file right, mt-daapd should start the initial scanning of your mp3 library. After that, all your mp3s should be browsable and playable through the new share in iTunes.DoubleShare

At least in with the version of mt-daapd I’m using (0.2.4) I get two identical shares in iTunes. I haven’t figured out why and frankly I don’t care as long as I can play my music.



Filed under Geek speak, Linux, Mac

7 responses to “Sharing music from Linux to iTunes

  1. Pingback: iTunes everywhere at Some people call me Fredrik

  2. Pingback: » Blog Archive » Ubuntu jakamaan musiikit iTunes jakona

  3. Feanaro

    Actually, when using a debian-based system, there is an easier way, just “aptitude install mt-daapd” will install al the necessary packages (including avahi: debian’s bonjour-implementation). Editing the config file (/etc/mt-daapd.conf) is all that is needed. The file is wel documented. Just an easy, alternative solution.

  4. Yes, these instructions were made for Debian Sarge, where mt-daapd wasn’t available. In Etch, on the other hand, the mt-daapd package is a very convenient way to install the whole system, as Feanaro points out.

  5. Hi there, I found your blog from Google while searching for more info and your blog looks very interesting for me.

  6. Manoj

    Does this work with all versions of iTunes.?

  7. Joe Bozard

    i know i’m a little off topic, but i just wanted to say i love the layout of your blog. i’m new to the blogegine platform, so any tips on getting my blog looking good would be appreciated.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s