Installing Firefly on a Western Digital MyBook World Edition NAS

v1.1 14/08/07

These instructions require an ssh client to be installed on the machine from which you will be hacking the MyBook. Any *nix build (Linux/BSD/OSX etc.) should provide this as standard but Windows will probably require additional software installing such as PuTTY.

It should be noted that, for the sake of simplicity, I have installed all software in the default locations. However, if it is desired to keep all user-installed software together, it should be possible to specify different target directories, using --prefix=/opt for example, during the software configure stages pre-compilation. I am also assuming that no additional codes are being installed to cope with .ogg, .flac etc.

Lastly, and importantly, these instructions are a summary, written after the event, of what I did to get Firefly running on my 500GB MyBook World Edition and serving iTunes. I have not tested them on a clean system and you proceed at your own risk.

Enabling SSH access

Start by create a new user using the MyBookWorld web interface, http://mybookworld, and then enable permanent SSH access using the instructions and scripts kindly provided by Martin Hinner on his website: http://martin.hinner.info/mybook/sshaccess.php

Reboot the MyBook and connect to it using ssh with the normal user login that you have just created.

Disable Mionet

Unless you are intending to use the Western Digital Anywhere Access facility, it is worth disabling the Mionet process to save memory & CPU cycles. This can be done by simply renaming the launch script in the /etc/init.d directory so that it is not picked up during the system startup process. As root user,

# cd /etc/init.d
# mv mionet.sh mionet.sh.bak
# reboot 

Connect again using ssh and check to see if Mionet is running:

# ps -ef | grep mionet

If it isn't, the only thing that should be returned by this is something similar to:

1002      1157  1125  0 22:39 pts/0    00:00:00 grep mionet

Download Firefly and other required packages

Download the following source-code tarballs and copy them to /opt or wherever you wish to keep the package source code.

''This alt link might work better then the nightlies link''

Compile & install the sqlite database libraries

# cd /opt
# tar -xzvf sqlite-3.4.1.tar.gz
# cd /opt/sqlite
# ./configure
# make 
# sudo make install

Compile & install the zlib libraries

# cd /opt
# tar -xzvf zlib-1.2.3.tar.gz
# cd /opt/zlib-1.2.3
# ./configure
# make 
# sudo make install

Compile & install the libid3tag libraries

# cd /opt
# tar -xzvf libid3tag-0.15.1b.tar.gz
# cd /opt/libid3tag-0.15.1b
# ./configure
# make 
# sudo make install

Compile & install Firefly

# cd /opt
# tar -xzvf mt-daapd-svn-1586.tar.gz
# cd /opt/mt-daapd-svn-1586
# ./configure -with-id3tag=/usr/local -enable-sqlite3
# make 
# sudo make install

This should leave the mt-daapd binary in /usr/local/sbin.

With the default installation settings shown above, the sqlite3 and libid3tag libraries are installed in /usr/local/lib and now need to be soft-linked to /lib. As root,

# ln -s /usr/local/lib/libid3tag.so.0 /lib/libid3tag.so.0
# ln -s /usr/local/lib/libsqlite3.so.0 /lib/libsqlite3.so.0

Copy over and setup the iTunes Library

Next, copy the sample Firefly configuration file over to /etc:

# cp /opt/mt-daapd-svn-1586/contrib/mt-daapd.conf /etc/.

Edit the relevant lines of the configuration file now in /etc to specify the database type and the location of the iTunes files. These are:

*NOTE* You might have to change the "runas" part of the .conf file from nobody to root or any other user which have rights to run the application.

db_type = sqlite3
mp3_dir = /music

Now, using web interface, create a MUSIC folder. This is where the iTunes directory will sit. Copy the iTunes directory from your computer over to the MUSIC directory on the MyBookWorld using drag and drop.

The iTunes directory now needs to be soft-linked to where Firefly can find it (it apparently needs to be in the same filesystem). Back on the command line, again as root,

# mkdir /music
# ln -s /shares/internal/MUSIC/iTunes /music/iTunes
# chmod ugo+rwx /music/iTunes

Note that I changed the directory permissions purely to prevent possible problems so the chmod above may not be necessary.

Configure Firefly to start on system boot

A launch script to start Firefly on system boot can be easily generated by copying and modifying one of the existing scripts. I chose to use the samba launch script.

# cd /etc/init.d
# cp samba.sh S99firefly

Edit the S99firefly script to match the following:

#!/bin/sh
#
# Start Firefly 
#

start() {
        echo "Starting Firefly"
        /usr/local/sbin/mt-daapd  -c /etc/mt-daapd.conf
}

stop() {
        echo "Stopping Firefly"
        killall mt-daapd > /dev/null 2>&1
}
restart() {
        stop
        start
}

case "$1" in
        start)
                start
                ;;
        stop)
                stop
                ;;
        restart)
                restart
                ;;
        cleanup)
                ;;
        *)
                echo $"Usage: $0 {start|stop|restart}"
                exit 1
esac

exit $?

Restart and check to see if Firefly is running

Now, reboot, login again using ssh and check to see if you have mt-daapd processes running:

# ps -ef | grep mt-daapd

You should see something similar to:

nobody     795    1 0 19:16 ?        00:00:00 /usr/local/sbin/mt-daapd -c /etc/mt-daapd.conf
nobody     796    1 0 19:16 ?        00:00:01 /usr/local/sbin/mt-daapd -c /etc/mt-daapd.conf
nobody     804  796 0 19:16 ?        00:00:00 /usr/local/sbin/mt-daapd -c /etc/mt-daapd.conf
nobody     805  804 0 19:16 ?        00:00:00 /usr/local/sbin/mt-daapd -c /etc/mt-daapd.conf
1002      1211 1125 0 23:02 pts/0    00:00:00 grep mt-daapd

Lastly, connect to the Firefly web interface at <mybookworld_ip_address>:3689 using the web-admin username and password in the configuration file. Now, run a first scan manually to ensure that Firefly finds the files you have copied over.

If all the above has worked, when you launch iTunes on your computer you should see the Firefly server appear on the left-hand side menu. :)

MyBook World Edition Install (last edited 2007-08-17 18:54:07 by h54n6c1o1049)