HOWTO’s

Setup iTunes server in Linux

Introduction
If you follow the directions below you will have an iTunes music server using the daapd protocol. This allows you to share a playlist and shared drive to all iTunes or compatibale players. You can share not only the actual raw mp3 streams but *.mp4 *.m4a *.aac and *.ogg Many players in Linux now support this upon starting the program. These include:

  • Amarok
  • Rhythmbox
  • Banshee
  • What happens though if you want to run this on a headless MP3 media server?

    Getting what you need
    daapd relies on several specific libraries. Most are now included in Fedora/Ubuntu or available via apt or freshrpms.net. The only thing I needed was mt-daapd which is the open source version of the Apple opensource version of the ieee opensource zeroconf spec…confused yet? There are packages for most distros at the mt-daapd webpage.

    libid3tag and howl-devel can be installed via apt or freshrpms.net with a single command:

    # apt-get install libid3tag libid3tag-devel howl-devel

    If you want to have aac/mp4 support you will need to grab mpeg4ip and compile. This isn’t an easy install. Check Dapper and Core 5 for latest support in packaged format.

    Configuration

    The example config is pretty self explanitory. The following is an example used on a testbed server that should give you a good idea of what you need to change:

    web_root /usr/share/mt-daapd/admin-root
    Port 3689
    ServerName Music Server
    admin_pw blah
    db_dir /var/cache/mt-daapd
    mp3_dir /mnt/crapola/music
    servername Music Server
    playlist /etc/mt-daapd.playlist
    #password mp3
    rescan_interval 300
    compress 1

    The main things here are the web_root which allows a web interface to run on http://host:3689 This is handy for when you add more music but don’t want to restart the service. The admin_pw is the actual password you will need to login to the web interface. The mp3_dir is going to be where your share of mp3s are hiding. Point this to the top level directory. Make sure to put playlist pointing to the mt-daapd.playlist as this will allow us to create “Smart Playlists” If you want to password your iTunes music shares uncomment out the #password. The rescan_interval causes the daemon to go out and look for new music every 300 seconds. This is good if people are downloading new music into the directories. Compress is a must when you start transfering that 15 MiB playlist across the network.

    Start the server

    Before you can start the server the current version of mt-daapd doesn’t correctly point to the binary. You need to edit /etc/init.d/mt-daapd and change the path from /usr/local/bin/mt-daapd to /usr/bin/mt-daapd Once you do this your init script should work with no problems. Once you have fixed the init script error issue the following commands to make sure the service starts on boot:

    chkconfig --add mt-daapd
    chkconfig --add mDNSResponder
    or
    services-admin

    Lets now go ahead and start the services:

    /etc/init.d/mt-daapd start
    /etc/init.d/mDNSResponder start

    We have now started the actual daemon that controls the daap protocol and the Apple DNS responder A.K.A. Rendezvous A.K.A ZeroConf Fire up iTunes and you should see Music Server listed on the left side. If you do not see this chances are you do not have iTunes set to listen for shares. Navigate to preferences and check the box that listens for music shares.

    Great one playlist…this stinks!

    As you can tell there is just one playlist called Recently Added if you used the default /etc/mt-daapd.playlist. You can edit this file and add your own settings. Chances are you want Smart Playlists that sorts the music based on genre or artist. The example has very good examples of the many ways to do this. The following is an example from the test bed server:

    "Acoustic" {
    genre includes "Acoustic"
    }

    “Big Band” {
    genre includes “Big Band”
    }

    “Blues and Jazz” {
    genre includes “Blues”
    }

    “Christian” {
    genre includes “Religious” ||
    genre includes “Christian Rap” ||
    genre includes “Contemporary Christian”
    }

    “Christian Praise” {
    genre includes “Contemporary Christian”
    }

    “Christian Rap” {
    genre includes “Christian Rap”
    }

    “Christian Rock” {
    genre includes “Religious”
    }

    “Country” {
    genre includes “Country”
    }

    “Pop” {
    genre includes “Pop”
    }

    “Rock” {
    genre includes “Rock”
    }

    “Soul” {
    genre includes “Soul”
    }

    “Soundtrack” {
    genre includes “Soundtrack”
    }

    “Techno” {
    genre includes “Techno” ||
    genre includes “Electronic”
    }

    “Top 40” {
    genre includes “Top 40”
    }
    You can use things like artist includes “Third Day” instead of genre. If you want to string “and” to the playlist use the || at the end of a line. After you have done a major chance restart the services!

    What else?

    Using the Rendevous Proxy you can actually use this across the internet to keep your music accessible anywhere. This is not a method to pirate music. This is simply a way to keep all the computers on your network on the same music database. This would be great for a house with 3 or 4 computers and a linux server. Other uses are the SlimDevices network mp3 players that hook into stereo equipment.