HOWTO Install Firefly Media Server (mt-daapd) on CentOS 5

HOWTO Install Firefly Media Server (mt-daapd) on CentOS 5

From Consultancy.EdVoncken.NET

Jump to: navigation, search

I have a fairly large collection of Audio CDs, all ripped to MP3. Currently these files are served from my fileserver, using Samba and NFS. The library is also shared with iTunes using a Windows XP PC with iTunes and the iTunes Library Updater (ITLU) utility.

This solution has several drawbacks:

  • ITLU is no longer being developed, so I'm reluctant to update my iTunes installation on the PC
  • Windows PC needs to be left running for iTunes library sharing

A better solution would be to share the iTunes library from the CentOS fileserver, using Firefly Media Server (formerly known as mt-daapd).

Contents

[edit] Obtaining Firefly Media Server

The source code for Firefly can be downloaded from their website. The build mechanism consists of the well-known "./configure; make; make install" sequence from GNU AutoConf.

Here, we will use the stable version (mt-daapd-0.2.4.2).

[edit] Dependencies

You will need at least the following packages on CentOS 5 to build the software:

  • gcc (C compiler)
  • gdbm-devel (for gdbm.h)
  • libid3tag-devel (for id3tag.h)
  • zlib-devel

[edit] Build the software

Note: in this HOWTO, I will build and install the software the "old-fashioned way". The archive also contains a ".spec" file that is typically used on RedHat / Fedora systems for building RPM-format software packages. The instructions below should be fairly generic and independent of your Linux distribution.

Untar the source archive into a temporary subdirectory and run the ./configure script:

 # cd /path/to/mt-daapd-0.2.4.2/
 # ./configure
 < ...snip... >
 configure: creating ./config.status
 config.status: creating src/Makefile
 config.status: creating admin-root/Makefile
 config.status: creating contrib/Makefile
 config.status: creating debian/Makefile
 config.status: creating Makefile
 config.status: creating config.h
 config.status: config.h is unchanged
 config.status: executing depfiles commands

If you run into problems, read the config.log output. Most likely, you did not install one of the dependencies. I missed the zlib-devel dependency at first, and got a completely unrelated error message during ./configure - the solution was in config.log.

Next, build the software:

 # make
 make  all-recursive
 make[1]: Entering directory `/path/to/mt-daapd-0.2.4.2'
 Making all in src
 make[2]: Entering directory `/path/to/mt-daapd-0.2.4.2/src'
 < ...snip... >
 make[1]: Leaving directory `/path/to/mt-daapd-0.2.4.2'

Finally, install the software

 # make install
 < ...snip... >
 make[1]: Leaving directory `/path/to/mt-daapd-0.2.4.2'

This will install the mt-daapd daemon in /usr/local/sbin/, and the webserver files under /usr/local/share/mt-daapd/.

[edit] Configure the software

  • Copy the example configuration files (/path/to/mt-daapd-0.2.4.2/contrib/mt-daapd.conf and mt-daapd.playlist) to /etc/
  • Edit mt-daapd.conf:
    • Configure the correct path to your MP3 collection. NOTE: there can be NO whitespace in the path, it does not work in this version.
    • Choose a nice server name (this is the name you will see under iTunes "Shared Libraries")
    • Enable logging to /var/log/mt-daapd.log
 mp3_dir    /path/to/your/mp3/collection
 servername MP3 Jukebox
 logfile    /var/log/mt-daapd.log

[edit] Run the software

  • Copy the startup script (/path/to/mt-daapd-0.2.4.2/contrib/mt-daapd) to /etc/init.d/
  • Enable and start the service
 chkconfig --add mt-daapd
 service mt-daapd start

Watch the logfile (/var/log/mt-daapd.log), the daemon will scan for MP3 files on first run:

 2009-01-04 17:34:12: Starting rendezvous daemon
 2009-01-04 17:34:12: Starting signal handler
 2009-01-04 17:34:13: Loading playlists
 2009-01-04 17:34:13: Initializing database
 2009-01-04 17:34:13: Starting mp3 scan
 < ...snip... >
 2009-01-04 17:37:29: Starting web server from /usr/local/share/mt-daapd/admin-root on port 3689
 2009-01-04 17:37:29: Registering rendezvous names
 2009-01-04 17:37:29: Scanned 7221 songs in  197 seconds

Now, open iTunes on your Mac (or PC) and look for shared libraries; you should see "MP3 Jukebox" in the list!

[edit] Creating Smart Playlists

Once you have confirmed that Firefly Media Server is running properly, you may want to set up some Smart Playlists. These are configured in /etc/mt-daapd.playlist. There are lots of examples in this file; I have added a couple of my own. I've prefixed each playlist with a keyword ("Genre: ") so they stay together when sorted.

 ### By Genre ###
 
 "Genre: Acoustic" {
     Genre is "Acoustic"
 }
 
 "Genre: Alternative Rock" {
     Genre is "Alternative Rock"
 }
 
 "Genre: Gothic" {
     Genre includes "Gothic"
 }
 
 "Genre: Pop" {
     Genre is "Pop"
 }
 
 "Genre: Rock" {
     Genre is "Rock"
 }