[HOWTO] Set up iTunes Server (forked-daapd)

DLNA, AirPlay, Chromecast, PS3, XBOX, iTunes, & other media players
Post Reply
toby_p9
New here
Posts: 4
Joined: Sat Apr 04, 2020 10:35 pm

[HOWTO] Set up iTunes Server (forked-daapd)

Post by toby_p9 » Tue Apr 07, 2020 4:59 pm

Hey everybody!

Since QNAP has dropped support for the old and outdated iTunes server that came pre-setup in Settings (Firefly Media Server), I searched for an alternative. I have discovered the excellent forked-daapd, which does the same as FMS, but better and more up to date. It has a ton of features - you can connect an Apple Remote, stream to AirPlay devices, etc.

Since installing something meant for Linux directly on QTS can be tricky sometimes, it took me some time to find a solution. This thread awoke my hopes, but it is nearly 10 years old and of course, all the download links are dead. So I continued searching and without further ado, I will tell you what I found:
A way to install forked-daapd on your QNAP device in 2020! I only tested this on my TS-451 with QTS 4.14.24 on firmware 4.4.2.1262, but I gather it should work on basically any QNAP NAS with the ability to install Container Station.

1) Container Station
Go to the QNAP App Store and download "Container Station". Open it. It will ask you for a folder to put its stuff in. I just created a folder "Containers" in the root of my NAS. Doesn't really matter what you put here, just make sure you remember and put it in anytime I mention the "Container"-folder. Then close "Container Station" again.

2) User Setup
For security reasons, you should now set up a separate User that has only the rights to access the "Container"-folder you just specified and your music library. Go to "Settings" -> Users -> Create -> Create a new User. Give it a name ("dockeruser" for me) and some "not-easy-to-guess" password (you are not gonna need this ever again - at least not for this tutorial). Click "Edit" under the point "Shared folder permission" and then check the checkmarks "RW" for the "Container"-Folder and the checkmark "R" for your Multimedia folder (if your music is there. Else, the folder your music is in). All others should stay empty. Click on "Create" to finish the setup of the user.

3) Find out ID of newly created user
SSH into your NAS.
(if you haven't set up SSH yet: go to Settings -> Telnet/SSH and activate SSH there. If you don't need this otherwise, you should deactivate it again after this tutorial, since it's a potential security risk. After you have activated it, open a command line interface ("command prompt" on Windows, "Terminal" on Mac) and then type

Code: Select all

ssh username@IP
where username is your admin user on the NAS and IP the IP address of your NAS.)
Then type

Code: Select all

id dockeruser
(where dockeruser is the name you have given the user created in step 2) and note down what it says in the fields "uid" and "gid" (should be two numbers, like 100 or 1000).

4) Install forked-daapd
Now open Container Station. Go to "Create Container" and type "daapd" into the search field. You should find "linuxserver/daapd". Click on "Install". Choose the latest version.

5) Configure forked-daapd
A configuration window will open. First of all, you can change the name if you wish to do so. Optional. Then, click on "Advanced settings". We will need to adjust some things here:
  • Environment: add a field named "GUID" here and in column "value", put in the value "gid" you noted down in step 3). Then add a field "PUID" and put in the value "uid" you noted down in step 3).
  • Network: in the dropdown for "network mode", choose "Host".
  • Shared Folders: here, add a field in the category "Volume from Host". Choose the folder of your music library in the Dropdown in the first field. In the field "Mount Point", you must put "/music" (without ""). Check only the box that says "Read" next to it. Optionally, you can also specify a location for the config file here. I tried to put it into the folder "Container" once and everything got messed up, so I would recommend you leave it at default.
Click on "Create". Your NAS will now set up the docker container.

6) Accessing the log
Click on "Overview". As soon as the install has finished (shouldn't take longer than a couple of seconds), your container should appear here. Click on it. You will now see the log output at the bottom. This will help you diagnose any problems. The logging level can be changed in the config file (see below). The log will ideally tell you that it started scanning. On my NAS, it scanned about 200 titles every 5 seconds. Pretty fast!

7) Web Interface
Congrats, you're finished! You can access the web interface of your new server at IP:3689 (where IP is the IP address of your NAS - so probably something like

Code: Select all

192.168.0.44:3689
It will stream automatically to any AirPlay devices detected in the network.
Don't forget to deactivate your SSH if you don't need it anymore. Log out of the shell using

Code: Select all

logout
and then deactivate it in the settings of your NAS.

Further (optional) Infos:

8 ) [OPTIONAL] Editing the config file
If you want to do that to personalise your daapd install, click on Settings while you're inside the window where your container log is shown. Then navigate to "Advanced Settings" -> "Shared Folders" and note down the path that is shown next to "/config" it will likely be long and convoluted. Then, use SSH again. You can now edit the file by typing "vi PATH" (where PATH is the path you just noted down). If you don't know how to use vi, please google "vi use". You will find plenty of tutorials. Inside the config file, you will find the chapter "library configuration". Here, you can set many interesting things (the file is self explanatory). Use name to adjust the name of your iTunes server. Use directories to specify a subfolder of your music library, if only that one should be scanned. You can also specify multiple here. Be aware that they must always begin with /music ! Use loglevel to adjust the amount your log outputs (should only be changed for debugging).
If you want to make your life easier accessing the config file in the future, you can create a symbolic link. Just type

Code: Select all

cd ACC_PATH
into the console (where ACC_PATH is the location you want to access the config file from) and then type

Code: Select all

ln -s PATH
(where PATH is the path to the file you noted down earlier). This will create a shortcut and you can, in the future, just modify this file at the location ACC_PATH.
Note: you need to restart your container for any config changes to take effect. Just click on "Stop", and, when it has finished, "Start".

9) [OPTIONAL] Setting up Apple Remote
If you want to set up a remote to control your server (which was the whole point of setting it up in my case), then go to the web interface and navigate to "Settings" -> "Remotes & Outputs". Then, open the remote app on your iOS device and click "Manually add a library". It will now display a code. Go back to the web interface and refresh the page (F5 on windows, Cmd+R on Mac). It should show your device and enable you to enter the code. You can now control the server from your mobile device, yay!

References: A shoutout to those people - I could not have found out this stuff without those tutorials!

Have fun with forked-daapd!
Toby

PS: This is my first post on this forum, I hope I've done everything right...

lajah
First post
Posts: 1
Joined: Mon Jan 06, 2020 2:24 am

Re: [HOWTO] Set up iTunes Server (forked-daapd)

Post by lajah » Thu Apr 16, 2020 10:38 am

Thank you for the excellent HOWTO post. I have successfully set up my container and the iTunes server. Just one question..

I added a second music library in the config file:
# Directories to index
directories = { "/music", "/music2" }

forked-daapd complains that it is "unable to derefrence music2". I have used absolute path, relative path to music2 but nothing seems to work. The documentation indicates that daapd supports multiple music libraries.

Any idea what I am doing wrong?

toby_p9
New here
Posts: 4
Joined: Sat Apr 04, 2020 10:35 pm

Re: [HOWTO] Set up iTunes Server (forked-daapd)

Post by toby_p9 » Thu Apr 16, 2020 9:34 pm

Hi lajah,
glad I could help! I wondered whether anyone would ever read this :D

Yes, file paths can be a bit tricky. I struggled with that error message for a while, too. The thing is:
Your container cannot access the NAS file system, except at the specified mount points (done in step 5 ("shared folders") of the setup).
So the container can only "see" whatever lies in the folder you specified next to /music. All paths to index need to start with "/music" and be relative to the folder you specified in step 5. Absolute paths will not work.

I can think of a couple of ways to solve your problem:
  • You can create a symbolic link in the folder at /music linking to your desired second library folder. You can do that by navigating to your music library using the command line and using the command I specified in step 8. Please note that any other programs that are indexing your first library might also follow this link and index the second one - that might lead to unintended consequences.
  • You can add your second music library as a second mount point (and call it "music2"). Unfortunately, this can, AFAIK, only be done at the creation of the container. So you'd need to delete your container and create a new one. In step 5, you can then add another mount point after /music. Please note that the path to your config file will change if you create a new container (and the config file will reset to defaults, of course, so you might want to back it up first). It will also need to scan your library again. Otherwise, there are no ill effects from recreating the container (I had to do so many times).
Don't forget to make sure the Container User you created in step 2 has read rights for any newly added folders.
Let me know whether it works (I have only ever tried with one mountpoint), so I can amend my original post to include this information.

danthony
New here
Posts: 4
Joined: Sat Feb 14, 2009 11:54 pm

Re: [HOWTO] Set up iTunes Server (forked-daapd)

Post by danthony » Tue May 12, 2020 5:54 am

I wondered whether anyone would ever read this :D

I have a feeling that this post is about to become quite popular, now that QNAP has removed support for iTunes Server in QTS 4.4.2.1270 build 20200410. Will let you know how it goes!

danthony
New here
Posts: 4
Joined: Sat Feb 14, 2009 11:54 pm

Re: [HOWTO] Set up iTunes Server (forked-daapd)

Post by danthony » Tue May 12, 2020 6:47 am

Well that was easy enough -- thank you!

johnlsmith20
New here
Posts: 2
Joined: Fri May 22, 2020 9:28 am

Re: [HOWTO] Set up iTunes Server (forked-daapd)

Post by johnlsmith20 » Fri May 22, 2020 9:35 am

Thanks so much for these instructions. For some reason, daapd doesn't seem to be able to find my media library. I don't get any errors and the web UI is working. It's just coming up with 0 albums 0 artists 0 songs, even though there are a ton. I tried naming the subfolder /music but no luck. FYI: I'm using a TS-251+ and have disabled the old firefly server.

toby_p9
New here
Posts: 4
Joined: Sat Apr 04, 2020 10:35 pm

Re: [HOWTO] Set up iTunes Server (forked-daapd)

Post by toby_p9 » Sat May 23, 2020 2:27 am

Hmm, that's strange. Sounds like a problem with the setup of the container, maybe? Check if you have specified the correct folder when setting up the environment. It is important to understand that the folder you specified there is called /music for daapd. Meaning if your music library is in foo/library and you have set up foo as the mountpoint "/music", you would need to tell daapd to go look in "/music/library".
I am not sure what will happen if you rename or move the folder you named as a mount point. In this case, I would set up daapd again (should be quick, you can skip steps 1 & 2).
Otherwise, make sure to read my reply to lajah, who seems to have a related problem.

Another possible problem could be an unsupported file format, though I doubt that. It should work with pretty much anything that is not very exotic.

Are there any problems at all mentioned in the log of your daapd?
Last edited by toby_p9 on Sun May 24, 2020 8:27 pm, edited 1 time in total.

danthony
New here
Posts: 4
Joined: Sat Feb 14, 2009 11:54 pm

Re: [HOWTO] Set up iTunes Server (forked-daapd)

Post by danthony » Sat May 23, 2020 5:30 am

johnlsmith20 wrote:
Fri May 22, 2020 9:35 am
FYI: I'm using a TS-251+ and have disabled the old firefly server.
Also a TS-251+, working fine for the most part -- except I updated the firmware before I realized QNAP discontinued support for Firefly. How do I disable Firefly after-the-fact with no control panel? Both servers continue to show up on my client devices, although only forked-daapd actually works!

johnlsmith20
New here
Posts: 2
Joined: Fri May 22, 2020 9:28 am

Re: [HOWTO] Set up iTunes Server (forked-daapd)

Post by johnlsmith20 » Sun May 24, 2020 12:35 pm

toby_p9 wrote:
Sat May 23, 2020 2:27 am
Hmm, that's strange. Sounds like a problem with the setup of the container, maybe? Check if you have specified the correct folder when setting up the environment. It is important to understand that the folder you specified there is called /music for daapd. Meaning if your music library is in foo/library and you have set up foo as the mountpoint "/music", you would need to tell daapd to go look in "/music/library".
I am not sure what will happen if you rename or move the folder you named as a mount point. In this case, I would set up daapd again (should go quickly, you can skip steps 1 & 2).
Otherwise, make sure to read my reply to lajah, who seems to have a related problem.

Another possible problem could be an unsupported file format, though I doubt that. It should work with pretty much anything that is not very exotic.

Are there any problems at all mentioned in the log of your daapd?
That worked. I wasn't understanding the mountpoint and folder path instructions. I made a new container and used the correct mountpoint and volume folder path and it worked. Scanned 7800 files in about 5 minutes or so. Am able to access the LS.IO library from Mac OS Mojave-iTunes app as well as a Mac OS Catalina-Music app. Thank you!

toby_p9
New here
Posts: 4
Joined: Sat Apr 04, 2020 10:35 pm

Re: [HOWTO] Set up iTunes Server (forked-daapd)

Post by toby_p9 » Sun May 24, 2020 8:35 pm

Glad to hear it works, johnlsmith20!
@danthony: Unfortunately, I don't know how to disable the old Firefly Server (and I cannot test it since I don't have it). Uninstalling could be tricky, since it was installed as part of the OS and there may be no uninstall script.
You could try to disable the start of Firefly in the autostart.sh script. That way, it will still be there but as soon as you reboot, it should not run anymore and will not show up on your devices. I am not sure how to do this on your NAS however, maybe Google can help you there :)

Post Reply

Return to “Media Streaming”