This is the old XigmaNAS forum in read only mode,
it will taken offline by the end of march 2021!



I like to aks Users and Admins to rewrite/take over important post from here into the new fresh main forum!
Its not possible for us to export from here and import it to the main forum!

[HOW-TO] Install Subsonic on NAS4Free Embedded

Jails with XigmaNAS
Forum rules
Set-Up GuideFAQsForum Rules
Post Reply
iainmacleod
Starter
Starter
Posts: 35
Joined: 23 Jun 2012 03:52
Status: Offline

[HOW-TO] Install Subsonic on NAS4Free Embedded

Post by iainmacleod »

This guide will step you through the entire process.

[*]Installing and Configuring a Jail
[*]Installing Required Packages for Subsonic
[*]Building FFMPEG to transcode FLAC, M4A (AAC), and Others.
[*]Installing Subsonic
[*]Creating Automated Start-up

http://geekfreely.blogspot.com/2013/04/ ... 4free.html

fsbruva
Advanced User
Advanced User
Posts: 378
Joined: 21 Sep 2012 14:50
Status: Offline

Re: [HOW-TO] Install Subsonic on NAS4Free Embedded

Post by fsbruva »

Nice job! However, there are a few errors and areas for improvement-

1. You download Subsonic 4.8, but try to untar 4.7
2. Your automated startup will only start subsonic if it is the first jail to be started, AND, will not start Subsonic if the jail is restarted for any reason.
3. If you are building and installing LAME from source anyways, there is no reason to download the tarball from denieru's page. (Your blog might outlast his file mirror, for instance)

Additionally, just because denieru downloaded the packages in that order doesn't mean you have to. The dependency information on openjdk7 will get a bunch of those packages automatically. Also, it might be helpful to provide explanation for why you are mounting the drive read only. Subsonic is capable of doing some work to modify Mp3's, and ro in the fstab will make it break. For instance, you can't upload into the Incoming folder or download Podscasts if it is mounted read only.

A few modifications to require less typing (or copy paste):

Code: Select all

mkdir /var/subsonic
mkdir /var/subsonic/transcode
is the does the same as:

Code: Select all

mkdir -p /var/subsonic/transcode
And

Code: Select all

cd /var/subsonic/standalone
tar xvzf /tmp/subsonic-4.7-standalone.tar.gz
Can be written as:

Code: Select all

tar xvzf /tmp/subsonic-4.7-standalone.tar.gz -C /var/subsonic/standalone
The -C argument tells tar to move into the standalone directory before extracting the tarball.

Now, I already solved the subsonic autostart problem (yesterday, in fact). You need to add the following line to the jail's /etc/rc.conf

Code: Select all

subsonic_enable="YES"
While you're at it, add:

Code: Select all

sendmail_enable="NONE"
Then, create a file in /usr/local/etc/rc.d/ called subsonic, and place the following code:

Code: Select all

#!/bin/sh
#
# Developed by: Matthew Kempe, 2013
#

# PROVIDE: subsonic
# REQUIRE: LOGIN
# KEYWORD: shutdown

. /etc/rc.subr

name=subsonic
rcvar=${name}_enable

load_rc_config "${name}"
#
# Configure the following variables for your installation
#
JAVA="/usr/local/openjdk7/bin/java"
SUBSONIC_HOME="/var/subsonic"
SUBSONIC_STAND="/var/subsonic/standalone"
SUBSONIC_HOST="192.168.1.3"
SUBSONIC_PORT="4040"
SUBSONIC_HTTPS_PORT="0"
SUBSONIC_CONTEXT_PATH="/"
SUBSONIC_MAX_MEMORY="150"
SUBSONIC_PIDFILE="/var/run/${name}.pid"
SUBSONIC_DEFAULT_MUSIC_FOLDER="/var/music"
SUBSONIC_DEFAULT_PODCAST_FOLDER="/var/music/Podcast"
SUBSONIC_DEFAULT_PLAYLIST_FOLDER="/var/music/playlists"
SUBSONIC_LOG="${SUBSONIC_HOME}/subsonic_sh.log"
#
# END user config section
#

required_files="${SUBSONIC_STAND}/subsonic.war"
required_dirs="${SUBSONIC_HOME} ${SUBSONIC_HOME}/transcode ${SUBSONIC_STAND}"

pidfile="${SUBSONIC_PIDFILE}"

start_precmd="rm -f ${SUBSONIC_LOG} && cd ${SUBSONIC_STAND}"
start_cmd=subsonic_start

stop_postcmd="rm -f ${SUBSONIC_PIDFILE}"

command="${JAVA}"
command_args="-Xmx${SUBSONIC_MAX_MEMORY}m \
  -Dsubsonic.home=${SUBSONIC_HOME} \
  -Dsubsonic.host=${SUBSONIC_HOST} \
  -Dsubsonic.port=${SUBSONIC_PORT} \
  -Dsubsonic.httpsPort=${SUBSONIC_HTTPS_PORT} \
  -Dsubsonic.contextPath=${SUBSONIC_CONTEXT_PATH} \
  -Dsubsonic.defaultMusicFolder=${SUBSONIC_DEFAULT_MUSIC_FOLDER} \
  -Dsubsonic.defaultPodcastFolder=${SUBSONIC_DEFAULT_PODCAST_FOLDER} \
  -Dsubsonic.defaultPlaylistFolder=${SUBSONIC_DEFAULT_PLAYLIST_FOLDER} \
  -Djava.awt.headless=true \
  -verbose:gc \
  -jar ${SUBSONIC_STAND}/subsonic-booter-jar-with-dependencies.jar > ${SUBSONIC_LOG} 2>&1 &"

subsonic_start() {
  eval "${command} ${command_args}"
  echo $! > ${SUBSONIC_PIDFILE}
  SUBSONIC_PID=`cat ${SUBSONIC_PIDFILE}`
  echo "Subsonic started, PID: ${SUBSONIC_PID}"
}

run_rc_command "$1"
You need to modify the files/foldernames as needed (the java bin location is particularly important). Once you do this and mark the script executable, you can interact with subsonic like a normal daemon, /usr/local/etc/rc.d/subsonic {start | stop | status}. Additionally, it will autostart any time the jail gets started.

Enjoy!!

iainmacleod
Starter
Starter
Posts: 35
Joined: 23 Jun 2012 03:52
Status: Offline

Re: [HOW-TO] Install Subsonic on NAS4Free Embedded

Post by iainmacleod »

Thanks for this information, I work on incorporating this information into my guide.

oldskater
Starter
Starter
Posts: 43
Joined: 10 Oct 2012 14:55
Status: Offline

Re: [HOW-TO] Install Subsonic on NAS4Free Embedded

Post by oldskater »

Thanks for guide. Unfortunately I am failing at the moment on the following

Code: Select all

pkg_add -v -r http://denieru.no-ip.org/filecache/subext/lame.tbz
Due to

Code: Select all

pkg_add: unable to fetch 'http://denieru.no-ip.org/filecache/subext/lame.tbz' by URL
Is there an alternative source I can use?

Edit: I think I can use this instead

Code: Select all

pkg_add -v -r http://ftp.urc.ac.ru/pub/OS/FreeBSD/packages-7/Latest/lame.tbz
I will continue and report back on how it goes

Ok that seemed to work ok so far, but I am now stuck on this

Code: Select all

wget http://downloads.sourceforge.net/project/lame/lame/3.98.4/lame-3.98.4.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Flame%2Ffiles%2Flame%2F3.98.4%2F&ts=1366036375&use_mirror=superb-dca2
With the following error

Code: Select all

[1] 14590
wget: No match.
[2] 14591
use_mirror=superb-dca2: Command not found.
ts=1366036375: Command not found.
[1]  - Exit 1                        wget http://downloads.sourceforge.net/project/lame/lame/3.98.4/lame-3.98.4.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Flame%2Ffiles%2Flame%2F3.98.4%2F

Edit: I have got past this problem by downloading the file manually and moving it to the root of my jail.

I will continue and report back.

fsbruva
Advanced User
Advanced User
Posts: 378
Joined: 21 Sep 2012 14:50
Status: Offline

Re: [HOW-TO] Install Subsonic on NAS4Free Embedded

Post by fsbruva »

The trouble you are running into is licensing issues with the LAME encoder.

FreeBSD is prohibited by law from distributing a compiled version of the LAME encoder. The last time that was allowed was back when FreeBSD was on version 7. Thus, you have two options.

Option 1:
Download the tarball from sourceforge and compile it yourself (kind of a pain)

Option 2:
See if someone on this nice huge internet cares enough about FreeBSD users to provide them with a pre-compiled copy of LAME. Also, it would be helpful if this person is not producing a commercial product....

OOOO!!! LOOK!!
http://www.xenopsyche.com/mkempe/subson ... .5.tar.bz2

You're welcome.

oldskater
Starter
Starter
Posts: 43
Joined: 10 Oct 2012 14:55
Status: Offline

Re: [HOW-TO] Install Subsonic on NAS4Free Embedded

Post by oldskater »

Thanks fsbruva, unfortunately by the time I saw your post I had gone through the fun of compiling lame myself.
But I will save the pre compiled one for future use. To be honest I am not sure how I would use a pre compiled version as I was just following iainmacleod's install instructions.
Do I copy it to the root of my jail then run something like

Code: Select all

install Lame_3.99.5.tar.bz2
But I do now have Subsonic working, it survives a reboot and all is looking good.
I only have one concern, quoting a question I read I read on iainmacleod's blog
Indeed you do create the Jail on a mnt, but the data is copied to the embedded system when it is run - so it is possible you don't have space.

I would recommend you back up, reinstall nas4free, giving it plenty of space on the USB for further jails, then reload your configuration.
Is this correct? I need to make sure on my embedded install I allow enough disk space for any future jails?

And for iainmacleod, thanks for the guide, I now have a working Subsonic running in a jail. Would you like me to document the steps in your guide that didn't work quite right for me?

fsbruva
Advanced User
Advanced User
Posts: 378
Joined: 21 Sep 2012 14:50
Status: Offline

Re: [HOW-TO] Install Subsonic on NAS4Free Embedded

Post by fsbruva »

First things first.

Subsonic needs lame or ffmpeg to be in its "Transcode" directory. The instructions above have you install a pre-compiled version of the software, which copies it to /usr/local/bin. But since Subsonic looks for it in the "Transcode" directory, you can either create a symlink (kind of like a Windows shortcut) or just copy the file. The pre-compiled version I posted would need to be downloaded, and then extracted. You would first fetch the tarball, and then extract is using tar (something like tar xvf {filename}). The x means extract, the v means verbose, and the f means the thing to extract is the file named {filename}. Once you do that, there will be two folders from that tarball - one for amd64 and the other for i386. You will just copy whichever one you need into Subsonic's Transcode directory.

As for the embedded concern - it shouldn't be a concern, because there is a mistake. The statement "but the data is copied to the embedded system when it is run" is incorrect. If you are following the instructions, you actually mount the permanent storage using a nullfs mount, rather than copy it. That is to say, you create a MASSIVE shortcut that points /mnt/proto (which is a temporary location) to a permanent location that is supported by non-temp storage, like a hard drive.

You don't need to mess with the embedded system size - that's the beauty of jails!

oldskater
Starter
Starter
Posts: 43
Joined: 10 Oct 2012 14:55
Status: Offline

Re: [HOW-TO] Install Subsonic on NAS4Free Embedded

Post by oldskater »

Thanks again fsbruva. As you can tell I am no expert with linux, but always trying to learn.
I did think that statement regarding jails was wrong, but thanks for confirming, I can now go ahead and have a play with another jail now I have subsonic working.

flbatl
NewUser
NewUser
Posts: 3
Joined: 08 Apr 2013 11:14
Status: Offline

Re: [HOW-TO] Install Subsonic on NAS4Free Embedded

Post by flbatl »

I need help accessing my files on Nas4free. I have subsonic up and running inside the jail but I can't access the movies and music on the nas. The folders are on /mnt/Media (Movies, Music, Tv Shows). Nas4free is on 192.168.1.102 and Subsonic is on 192.168.1.201. Any help is greatly appreciated.

Post Reply

Return to “Jails”