Page 1 of 2

How to install Subsonic on unRAID

PostPosted: Wed Nov 18, 2009 8:35 pm
by kapz
unRAID Server is a Network Attached Storage server operating system designed to boot from a USB Flash device and specifically designed for digital media storage. More information can be found on the website.

Subsonic has been invaluable to me for many years. I see no reason to be limited by a portable mp3 player (or waste money). Most cell phones these days can play music anyhow. Subsonic allows access to your entire music collection, not just what you have on the internal memory of your ipod/whatever. I hope this guide helps others try Subsonic on unRaid for themselves.

Just Get It Working…

1. Unzip to your flash drive and add the following to your go script...
Code: Select all
installpkg /boot/packages_global/jre-6u20-i586-1.txz

2. Simply telnet into your server and type "/boot/scripts/" or reboot your server.

3. Open a browser and type the URL http://tower:22111/subsonic/ from within your network (default server name). Just replace “tower” in the URL with your IP (or DDNS) to access Subsonic from outside the network. You may need to forward the port (22111) on your router if you are behind a firewall.

(VERY IMPORTANT) All settings in Subsonic will be lost if the files are not copied back to flash before a reboot. It is vital the "" script is run before a shutdown/reboot. A cron job was created in to backup subsonic's files once a day at 7pm (for people who rarely shutdown their server).

If you do not have unMenu installed (everyone should) with the Clean Powerdown package enabled then you should download the package to your flash "/packages_global/" folder and add a line to your go script to install it at the very top of your go script. (eg. installpkg /boot/packages_global/powerdown-1.02-noarch-unRAID.tgz).

NOTE: I use Joe L’s cache_dir script installed which is a great tool to prevent the drives from spinning up when just browsing files. It can be found at

How to update…

1. Download Subsonic Stand-alone.

2. Unpack subsonic-x.x-standalone.tar.gz files to “/subsonic/standalone/” on the flash drive (you must unzip the .tar to get the real files). Overwrite all the files.

3. Telnet into your server and type "/boot/scripts/" or reboot your server.

Technical Details…
    * This file is a copy of /subsonic/standalone/ You can open it with your favorite unix editor (here is one: metapad).
    * At the top of the file you will see Subsonic's configuration variables. Add "JAVA_HOME=/usr/lib/java" to the top (see below).
    * Optionally you may change the port number, context path, and increased the memory allocated for JAVA (I have a ton of music). The PID.txt path is used by the “” script.
    * The default podcast and music folder are not needed and can be set later in the Subsonic interface.
    * The Playlist path should be set to a non-volatile memory location. I am saving mine in on the flash drive.
    * Save /subsonic/standalone/ as “” in the same directory (eg. /subsonic/standalone/ It is important to save this file in unix format (metapad will display this in the status bar).
Code: Select all

    * JAVA JRE runtime needed to run subsonic.
    * Creates the path “/var/subsonic/data” and recursively copies the “/boot/subsonic/data” files here. It then creates symlinks for the transcode dependencies. There is a step to remove thumbnails which I will explain later. This folder needs to be copied back to non-volatile memory.
    * Creates “/var/subsonic/standalone” and recursively copies “/boot/subsonic/standalone” files here. This does not need to be copied back to non-volatile memory.
    * Creates “/tmp/subsonic/ehcache” and copies “/boot/subsonic/tmp-subsonic-ehcache” files. These files are created when Subsonic runs the first time. This folder should to be copied back to non-volatile memory.
    * Copies script to the hourly cron job (explained below).
    * Runs (explained below).
    * Subsonic needs to be copied back to non-volatile memory to maintain settings between reboots. This script adds a cron task which runs It is scheduled at 7pm daily. Running will remove the entry from crontab.
    * This hooks into the reboot/shutdown process and runs “" before the server shuts down. simply calls "" (very important), but other tasks can be added here if needed.
    * This is the hourly script to clean the thumbnails from ram. Subsonic caches album art and since it’s running in ram, you want to make sure this is not taking up unnecessary ram space.
    * I recently switched to using rsync instead of copy in The new search index files subsonic makes doesn't seem to be removed and rsync works much better. This file is what directories can be excluded when backing up from ram.

Compiling your own codecs for transcoding...
I have attached a few already compiled encoders to this post. The instructions are here if you want to add other encoders. Maybe someone can create a slackware package for these? These instructions are for lame, but can be used for each codec.

1. Download the packages needed to compile. Most of them I found at A lot of the main links are broken. I had to use the newest mirror links.
    - binutils-
    - cxxlibs-6.0.8-i486-4.tgz
    - gcc-4.2.4-i486-1.tgz
    - gcc-g++-4.2.4-i486-1.tgz
    - glibc-2.7-i486-17.tgz
    - kernel-headers-
    - make-3.81-i486-1.tgz
2. Create a folder on your flash drive (eg. /packages_compile/) and copy all the packages above to it (no need to unpack these).

3. In a telnet session change to the package directory in step 2 (type: "cd /boot/packages_compile"). Now install each package by typing "installpkg" and the name of the package (type: “binutils-”. Remember <TAB> is your friend. You can simply type "installpkg<space>" and the first few letters of the filename then hit the TAB key to auto complete. Repeat this for each .tgz file from step 1.

4. Download the source code for encoders. Here are links to the pre-compiled ones in the file.
5. Create a folder on your flash drive (eg. /boot/codecs/) and unpack each codec here.

6. In a telnet session, change directory to (type: "cd /codecs/lame-398-2"). Now type each of the commands below, hitting enters after each one.
Code: Select all
make install

7. In a telnet session change directory to “/usr/local/bin” path (type: "cd "/usr/local/bin"). You should see a file called "lame" (no extension). Copy the file to the transcode folder inside your SUBSONIC_HOME path. (type: "cp lame /subsonic/data/transcode/lame")

8. You should now be able to set a maximum bitrate per user within Subsonic.

Both FLAC and FAAD required a little more work.

Repeat step 6 and 7 for each encoder. Change directories to “/usr/local/lib/” and move all the codec related files to your flash folder (eg. /boot/subsonic/data/transcode/usr-lib/). My handles creating symlinks to these files in “/usr/lib/”. Use symlinks and don’t copy the files. For FLAC, you need to all files that start with “libFLAC” (you are in “/usr/local/lib/” type: “mv libFLAC* /boot/subsonic/data/transcode/usr-lib/”). And for FAAD you need all files that start with “libfaad” and “libmp4ff.a”. LAME also has library files, but they didn’t seem to be needed for Subsonic to transcode. It only needs to be in the transcode directory.

NOTE: There was a bug introduced in Lame 3.98 (and was not fixed in 3.98-2) which will sometimes cause an error to show up in the Subsonic log “can't update LAME-tag frame”. The lame version included here is version 3.97.

[b]I want to thank Sindre for a great music streaming application (please donate) :D

PostPosted: Thu Nov 19, 2009 6:56 pm
by sindre_mehus
Thanks for your hard work, kapz!

I've added a link to this tutorial on the page.

PostPosted: Thu Jan 28, 2010 6:59 pm
by kapz
I found a typo in one of my scripts. It's nothing that would cause Subsonic to not work. The script was scheduling to run the script at 7pm. I used * for the rest of the values which made all the minutes between 7:00pm-7:59pm valid (essentially running the script 60 times). I have fixed this and uploaded in the original instructions.

* 19 * * * /scripts/

0 19 * * * /scripts/

I also updated the script to create the destination folders if they don't exist and to exclude copying the Subsonic source files from RAM (since they don’t change).

PostPosted: Tue Feb 16, 2010 6:02 pm
by kapz
Path to download v3.9 changed in OP. The new version fixed the playlist order problem.

* Was notified that the crontab script had a wrong path in it. I have fixed this and added to the OP.

Upgrade from 3.8 to 3.9 is fairly simple...
1) run the "/boot/scripts/" This will save any changes made.

2) replace all the files in /boot/subsonic/standalone" with the new version (keep the script)

3) delete "/boot/subsonic/tmp-subsonic-ehcache/" and "/boot/subsonic/data/jetty/" directories from the thumb drive if they exist. (only the jetty folder has the web files)

4) and reboot

PostPosted: Fri Apr 23, 2010 3:52 am
by daquint
Hi there,

Thanks for the tutorial - but I am bit lost here.

I am editing these files directly on my flash drive and completing these steps through step 7.

It seems my go script is having issues finding the sh scripts its calling, and I am wondering if you could give me a hand (bit of a noob with the Linux stuff)

my go script:

# Start the Management Utility
# JAVA Runtime
installpkg /packages_custom/jre-6u6-i586-3.tgz

# Run Subsonic and add Backup Job.
/usr/local/sbin/emhttp &

Note: I am not using the /boot/ menu as I was a bit confused by steps 3 and 4 not mentioning a /boot/ but your step 5 explaining to copy files to the /boot/ (it is not a default directory for the flash Unraid). Perhaps thats my problem?

Here is my file structure:
Flash Root contains the following folders:
packages_custom (created by me for the JRE file)
scripts (the folder I created for your scripts03)
subsonic (folder I created to place the standalone,data, etc directories)

any help is appreciated - i really dont want to keep a windows box up for subsonic :)



PostPosted: Fri Apr 23, 2010 6:24 am
by Neph2010
kapz, excellent tutorial.

I have Subsonic running on my Unraid box though I do have one issue that I hope either you or someone else can help me figure out. the problem I'm having is the folder directories. I have my music in shares which spread over two drives. How would I add the share to subsonic's settings?


PostPosted: Fri Apr 23, 2010 4:45 pm
by kapz

I think I see the confusion. The unRaid system mounts the flash drive to "/boot". It shows up as "flash" on the samba share, but if you used ssh to log into the system /boot would be your flash drive.

You need to add "/boot" to the start of the following lines for the full path to the files.

# JAVA Runtime
installpkg /boot/packages_custom/jre-6u6-i586-3.tgz

# Run Subsonic and add Backup Job.

PostPosted: Fri Apr 23, 2010 4:51 pm
by kapz

If you are using shares in unRaid, you can just us the path to the share in the folder settings in subsonic. Shares are mounted in unRaid under "/mnt/user/". It does not matter what drives the files are on.

An example of my paths...


"MUSIC" is my unRaid share and the bold would be the music folder you want to show up in Subsonic.

Remember paths are cAsE SeNsItIve

PostPosted: Sat Apr 24, 2010 2:14 am
by daquint
HI - Thanks for the quick reply!

Ive tried it this way as well (with boot) with the same directory structure I noted in previous post and get two errors after it loads the JRE and the transcoding lines:

Please see image

Thanks for your help and patience!

PostPosted: Sat Apr 24, 2010 9:53 pm
by kapz

When editing the "/boot/subsonic/standalone/" file (Step #5) did you save it as ""?

The tmp-subsonic-ehcache error is normal the first time and will not happen once you get subsonic running.

PostPosted: Sun Apr 25, 2010 5:05 am
by daquint
I did - I now have two files in the

I have both the original '' and the new ''

in my directory (editing the flash directly through windows) of

(root of the flash)\subsonic\standalone

Do i need to delete the original once I rename it to _RAM?


PostPosted: Mon Apr 26, 2010 4:13 pm
by kapz
No you do not need to delete Were you able to get subsonic working? I've had some issues with subsonic sometimes not coming up even when the process has been started correctly.

If there are no errors when you run and subsonic doesn't display a reboot works for me.

Remember the URL is whatever you added to the SUBSONIC_CONTEXT_PATH=/subsonic setting in step #5.

From within the network, this would be http://<IP ADDRESS><COLON><PORT>/subsonic

PostPosted: Fri Jun 11, 2010 1:42 am
Thanks for your tutorial which I discovered in the lime-tech forum and I've been hooked to Subsonic on my unRAID server ever since. :D

Are there any tutorial to get HTTPS/SSL configured in Subsonic on unRAID? I would like to access my Subsonic via HTTPS is possible.

Thank you!

retain settings

PostPosted: Sun Oct 24, 2010 11:19 pm
by jarodtufts
I've got this installed and running fine on my unraid server. I purchased a license and am very happy.

But, has anyone figured out how to retain user settings between reboots of the unraid server? It seems to me that the user settings are kept in the database, but I can not figure out how to backup and restore the database properly.

PostPosted: Tue Nov 30, 2010 3:23 am
by gabbott
Not having luck getting flac transcoding to mp3. Logs dont show any errors. I have the precompiled lame codecs from the first post in subsonic/data/transocde and even tried putting them in /var/subsonic/data/transcode

Any ideas? I installed 4.2.