The MacValley blog

 

Welcome to the MacValley blog, your first stop for all the latest MacValley news and views.

 

Tom Briant

The MacValley blog

Editor: Tom Briant

 

Click here to email Tom

Click here for Tom's profile

 

 

To search the blog posts please use the box below

Thursday, November 27, 2014

The Return of Forked-Daapd! New and Improved! Thank you, Julien Blache

The Return of Forked-Daapd (Thank you, Julien Blache)

 

As a nerd in his shorts in his tiny condo in Canoga Park, CA; I have experimented with Linux and various iTunes music server apps. I have written about two music server Linux apps in the past, forked-daapd and Tangerine.  

The old version of forked-daapd (0.19) stopped working with iTunes after 15 minutes. The new version of forked-daapd, though, continues to work. To get it, though, you need to install Ubuntu Linux 14.10 “Utopic Unicorn”. This is the latest version with the latest apps.

To install forked-daapd ver 0.2x,  you will need to use the Terminal, so roll up your sleeves and get ready. I will guide you through the steps.

 

To get Ubuntu 14.10, you go to Ubuntu. Com and download the .iso disk image. It’s about 1.16 Gb in size. You will need to burn it to a DVD, not a CD. 

 

I do a lot of playing with Linux, so I have learned to use DVD-RW disks. When I burn a new DVD with a new version of Linux to install, OS X’s disk utility erases the old file to clear the way for the new one. So if you intend to play with Linux, get a package of DVD-RW disks to save yourself from a desk overrun with “coasters”.

 

To burn a Linux disk in OS X, open Disk Utility which you will find in your /Applications/Utility folder. 

 

Now press the Command key + B. This opens a File Dialog box for you to select the image file you want to burn to that DVD.  (Figure 1) 

 

Figure 1 selecting the disk image to burn

Having selected the file you want to burn, insert the blank or erasable DVD into the burner. Follow the on-screen prompts and you’ll have an install DVD in 10 minutes. 

 

Now you will need a DVD burner, too; if you go this route and install via a DVD. You could use a USB flash drive as an alternative means of installation. The Ubuntu site has instructions on installing the disk image on a USB flash drive.  That’s your extra-credit assignment!

 

The Ubuntu Linux install procedure will remind you of installing OS X from a disk, if you go that far back. You can select which hard drive you want to install to, set up your language, keyboard, and time zone preferences. You set up your user name, your password, and the name of your computer.  Then you sit back as Ubuntu presents a slide show as installation goes on, showing the benefits of Linux. 

 

At the end, you reboot the machine, remove the DVD, and press the ENTER key. You should start up  in Linux or go to the GRUB menu which lets you choose between the various systems installed on your computer. On my test rig, I have four hard drives (!), each with a different operating system. See Windows Hints at the end if you have trouble with a dual-booting Windows/Linux system. 

 

So you’ve installed Ubuntu Linux 14.10 on a PC. Now what?

 

You will want to install the updates as your first thing. You will see a blinking/bouncing icon asking for your attention. Install the updates. 

 

Now you want to install several pieces of software from the Terminal’s command line. This may look like Linux voodoo, but I will explain it to you.    

 

You first want to install netatalk, which allows you to connect your Linux machine to your Mac using the Apple File Protocol (AFP).  

 

Open the Terminal by pressing Control+Alt+T. The Linux Terminal comes up, looking a lot like the OS X Terminal. Well, they are cousins with their roots in UNIX. 

 

Enter the following command into the Terminal sudo apt-get install netatalk


 

 

Enter your password when requested. You won’t see it on the screen, but press ENTER when you’re done. 

 

Follow the prompts pressing Y when asked to. 

 

Here’s how it breaks down. sudo makes you a temporary superuser with root privileges

 

Apt-get is the command-line utility for installing programs. It comes from the Debian version of Linux. Ubuntu and many other distros of Linux descend from Debian.

 

Install tells apt-get that you want to install the following program.

 

Netatalk is the program you want to install. It comes from a Ubuntu repository. Think of it as the command-line equivalent of Apple’s Mac App Store, only predating it by several years.

 

Once the installation finishes and you return to the command prompt, you need to edit netatalk configuration file. To do that, enter this command:

 

Sudo nano /etc/netatalk/atalkd.conf

 

Again, sudo makes you a temporary superuser. You’ll need to enter your password to gain temporary privileges.

 

nano is the Terminal-based editor. It’s simple to use, compared to Vim and Emacs, other Terminal-based editors of much great complexity. 

 

/etc/netatalk/atalkd.conf is the path to the atalkd.conf configuration file. 

 

You only need to add the phrase eth0 to the bottom of the configuration file.  That’s a Zero at the end of the eth, not an o.

Netatalk conf editied with eth0

 

 

 

Now look in your Finder. If you connected the Linux computer to your LAN, you should see its computer name appear in the Finder’s sidebar under the Shared devices

In this picture, the shared device is Minotaur. For those of you paying attention, I recycled a picture above showing a Linux machine called Ellery. 

Shared devices showing miinotaur

 

Installing and Configuration of forked-daapd

 

The installation of forked-daapd is easy. You enter this command into the Terminal:

 

Sudo apt-get install forked-daapd

 

Enter your password when requested. You’ll see a lot of text scroll by. When asked for your permission, type “y”.

 

Now for the configuration of forked-daapd. I have read too many articles that gloss over this portion. It is not as easy as the proverbial pie and I will show you the pitfalls.

 

First off, you have to edit another configuration file, /etc/forked-daapd.conf

 

You can use the simple nano editor for this. 

 

This is the part of forked-daapd.conf that you need to edit initially.

 

# Library configuration

library {

# Name of the library as displayed by the clients

# %h: hostname, %v: version

name = "My Mighty Minotaur Music on %h"

# TCP port to listen on. Default port is 3689 (daap)

port = 3689

# Password for the library. Optional.

#password = ""

 

# Directories to index

directories = { "/home/thomas/Music" }

 

 

First off, the name of the libray displayed to clients.

 

 By default, it’s name= “My Music on %h”

 

I just changed it to “My Mighty Minotaur Music on %h”  The “%h” refers to the name of the computer, which in this case is Minotaur.

 

Now the line read “# Directories to index” This is the path to the directories with the music you want to serve up.  This is the line in the configuration line that will drive you nuts if you’re not careful.

 

As you can see, I have entered “/home/thomas/Music” Notice that some words come in lower-case and the last word comes capitalized. Pay Attention, as Linux is case-sensitive unlike OS X.

 

I’m going to show you how to find that path with the correct capitalization without wasting time.

 

First, open your Terminal with Control+Alt+T You will open to a prompt that should display your user name and the name of the computer. In my case, it’s “thomas@Minotaur”

The basic thomas and minotaur screen prompt

 

 

Now enter the command ls (list) and press the ENTER key. You won’t need to enter your password.

Listing of folders within HOme direcotry of Thomas and miniotaur

 

You should see a listing of the directories within your Home directory.  One of these should be Music.

Now enter the command cd Music to move into the Music directory.

Move with CD into the Music folder of hte home directory

 

Now my command prompt displays “thomas@Minotaur:~/Music$” This means I am in the Music directory.

Now do ls  again to see any directories that you have copied into Music. You should see any directories (folders) of music that you copied in. 

Now for the million-dollar command. Enter pwd (print working directory) which gives you the path from the root to the directory you stored the music in.  Press the ENTER key. Again, no password is needed.

The money shot showing pwd to display path to music directory

 

In my case, it’s “/home/thomas/Music”  Note the spelling and especially any capitalized words.  Yours should be different from mine.

Enter that exactly as the path in forked-daapd.conf

 

Starting and Stopping forked-daapd

Forked-daapd is a service that automatically starts up when you start up Linux. It will rescan and index the music you have placed in the directory you designated. 

If you add or subtract music during a session, forked-daapd will NOT automatically rescan and index these changes. You have to manually stop and start the program.  

To stop forked-daapd, open the Terminal and type

 sudo /etc/init.d/forked-daapd stop

 

To restart a stopped session of forked-daapd, open the Terminal and type

sudo /etc/init.d/forked-daapd start

Each time you stop and start , you have to enter your password.

 

Hints for Windows users

If you use Windows and particularly if you dual boot with Linux, I have some tips for you. 

First, Windows 7 & 8.1 include facilities for burning image files to CD or DVD. Right-click on the image file in the Windows Explorer. You will see an option for burning DVDs from image files. 

Second, if you want to play with Linux on a dual-boot machine, you need to know about the Linux boot repair distro. This is a specialized Linux distro that will repair your GRUB boot menu. I recommend it you get it and burn several copies, in case you can’t find the first one. At that point, you’ve probably can’t boot into either Windows or Linux.  Get it from here. It’s a Godsend for those of us who play with Linux. 

Third, if you’ve copied music folders from your Windows user directory to the Linux music directory, you may find that they don’t appear in the music files forked-daapd lists on iTunes. This is a “WTF” moment. 

Now the iTunes files I copied from my Mac worked fine. What’s the problem? The problem is pesky permissions

For example, I copied a folder of music from The Cleveland Orchestra from my Windows iTunes directory to my Linux Music directory. I stopped and started forked-daapd. What?! No Cleveland Orchestra?! What is the problem?

As I said, the problem lies with the file and folder permissions. 

Here is a screenshot of The Cleveland Orchestra folder. 

 

Cleveland Orchestra permissions showing NO ACCESS

Here is a screenshot of the permissions for Alice Cooper’s Greatest Hits, which displays in iTunes from forked-daapd. 

Alice Cooper folder showing ACCESS

 

 

Note that the permissions for the Cleveland Orchestra for group and others do not allow access to files. With Alice Cooper’s Greatest Hits, group and others do have access to files.

So. Change the permissions for The Cleveland Orchestra to match those of the Alice Cooper’s folder.  Click on the downward arrow at the right-hand side of Access.

Change the permissions within the folder, too. Click on that button

Click on Change and you’re done.

Now stop and restart forked-daapd and voila! The Cleveland Orchestra plays through forked-daapd on iTunes. 

Cleveland Orchestra music folder in iTunes from f d

 

Conclusion

This article covered how to install and configure forked-daapd 0.2x. I would like to thank Julien Blache for his work in developing this app and also to everyone else who has worked on it over the years. Your work, ladies and gentlemen, is greatly appreciated. 

Please see my earlier articles on forked-daapd and the Tangerine music server if you need more detail on a part I glossed over. 

And last of all, but not least, a big, big vote of thanks to Arvid Srinivasan and his original Mac|Life article on building an OS X friendly Linux Music Server using an old Windows PC. I refer back to that article for many details.  Thank you MacLIfe and Future Publications for allowing me to borrow from that article. 

Today is Thanksgiving here in the United States, which begins the holiday season of feasting and celebrating. I’ll post a humorous article sent to me by my cousin Judy about how to conduct yourself. 

 

Tom Briant

Editor, MacValley 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 
















No comments:

Post a Comment

 

 

Blog Archive