Installing Subsonic 5.0
Part 1 of this post can be found here
With the Subsonic Jail created, you now need to install Subsonic.
These instructions are based on https://lameguy.wordpress.com/2013/02/08/subsonic-install-in-freebsd-jail/
SSH into the Subsonic Jail by entering from Terminal
e.g. ssh firstname.lastname@example.org
Enter the root password and you should be taken to a command prompt for NAS4Free!
this checks your new jail, you should see something like this
Based on the above output, enter the jail by entering
jexec 7 csh
Now configure the server with the necessary packages
As I am using a i386 I will download mine from ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-9.2-release/Latest/
If you are using AMD 64 Bit then download from ftp://ftp.freebsd.org/pub/FreeBSD/ports/amd64/packages-9-stable/Latest/
The following command sets the location where the packages are going to be downloaded:
setenv PACKAGESITE ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-9.2-release/Latest/
Now start installing the packages required by Subsonic:
pkg_add -v -r xtrans
pkg_add -v -r xproto
pkg_add -v -r xextproto
pkg_add -v -r javavmwrapper
pkg_add -v -r http://denieru.no-ip.org/filecache/subext/lame.tbz
pkg_add -v -r flac
pkg_add -v -r ffmpeg
pkg_add -v -r openjdk7
Create folders and download and extract Subsonic Standalone v5.0
cp /usr/local/bin/lame /var/subsonic/transcode/
cp /usr/local/bin/flac /var/subsonic/transcode/
cp /usr/local/bin/ffmpeg /var/subsonic/transcode/
tar xvzf /tmp/subsonic-5.0-standalone.tar.gz
chmod 777 *.*
Assuming the above installed successfully, enter the following to start Subsonic manually:
It takes about a minute for Subsonic server to start up, in the meantime go to your web browser and enter the ip address you assigned to your subsonic Jail.
If you can not remember In NAS4Free go to Extensions > TheBrig and check it from there.
Subsonic runs on port 4040 so the url you need to enter would be your-jail-IP-address:4040. e.g., 192.168.1.49:4040.
The default Subsonic username and password are both admin.
With Subsonic hopefully up and running, we now need to make the above script run automatically whenever the NAS4Free server starts.
From NAS4Free go to System > Advanced > Command Scripts
Click on the ‘+‘ sign to add an additional command script as follows:
Command: jexec 1 /var/subsonic/standalone/subsonic.sh
Save and reboot your server.
If all is well, you should be able to login to subsonic as before on port 4040.
Accessing your Music stored in NAS4Free from within your Subsonic Jail
Jails separate your installed applications like Subsonic from your NAS4Free server. The downside is that they are isolated from your NAs servers storage and in the case of Subsonic, your music.
To get subsonic to see your music you need to setup your Jails fstab so it mounts your music directory on your NAS4Free server locally within the Jail.
To do this go to your Jail’s settings (Extensions > TheBrigg) and then select the settings for your Subsonic Jail. You will need to create an Fstab entry to mount your NAS4Free directory to a mount point within your jail.
If you wish to find more about Fstab see https://www.freebsd.org/cgi/man.cgi?query=fstab%285%29&sektion=
Below is the configuration for my Subsonic Jail
/mnt/data1/Music /mnt/data1/jail/Subsonic/mnt/music nullfs rw 0 0
The above fstab entry can be broken down as follows:
/mnt/data1/Music – This is the directory where my music is located on my NAS4Free server
/mnt/data1/jail/Subsonic/mnt/music – This is mount point WITHIN my subsonic Jail.
nullfs rw 0 0 – The important bit is rw which stands for Read/ Write, which you need in order to upload music to your NAS4Free music directory via Subsonic. The alternative option is ro which is Read Only which does what it says!
To setup this up do the following:
- Identify the path to your music on your NAS4Free server e.g. /mnt/data1/Music
- Create a directory (e.g. music) in your Susonic Jail’s mnt directory where you wish to mount your NAS4Free Music directory /mnt/data1/jail/Subsonic/mnt/music. To create a directory called music within the mnt directry use the Unix command mkdir music.
- Now put all the above (from 1 and 2) together along with nullfs rw 0 0 and place your Fstab entry into your NAS4Free Subsonic Jail Fstab as in the screenshot above and example above.
- Save and Apply the changes and reboot your NAS4Free server.
- Once the NAS4Free server has restarted, test that the mount has worked. SSH back on to your Subsonic jail, navigate to your mount point directory e.g. mnt/music by entering cd /mnt/music and then enter ls to list the contents. If the mount has worked you should see the contents of your NAS4Free Music directory within the jail.
- Login to Subsonic and go to Settings and point this to the mount point you created in step 2 above. Below is how it should look in Subsonic.
7. Click on Scan Media folders, this should show in the top right hand corner that it is scanning folders.
Subsonic is now installed and running under NAS4Free. Enjoy!
If nothing is found check the log files for errors under the About menu option, it may give you a clue as to what may be going wrong. A common problem is that there may be a problem with the database (as happened to me) and nothing appears. To resolve (source http://forum.subsonic.org/forum/viewtopic.php?f=2&t=10835):
- Uncheck the check boxes for ALL Enabled folders
- Click Save
- Click on Clean-up database
- Click on Scan Media Folders Now
- Re-enable your media folders
- Click Save
- Rescan your media folders by clicking on Scan Media Folders Now