Subsonic install in FreeBSD jail

This post is a continuation of the “FreeBSD jail on embedded Nas4Free install” post, which covered how to setup a FreeBSD jail on an Nas4Free embedded install. This post is going to cover setting up Subsonic standalone server inside the jail.

Subsonic is a piece of software i can recommend to anybody running a NAS server since with it you can use your NAS also as a media jukebox.

SSH to the NAS

After you logged on to the NAS, check that the jail is up and running using the “jls” command.The output should look something like this:

JID             IP Address                   Hostname                      Path
1                192.168.1.201             plugins.domain.local       /jail/plugins

Obviously the output on you NAS might differ from this one when it comes to the IP/Hostname and Path. Now lets enter the jail with the following command:

  • jexec 1 csh

Install Subsonic required packages

One thing i’ve noticed is that the pkg_add command doesn’t function properly inside the jail. To fix this you have to run the following command:

  • setenv PACKAGESITE ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-stable/Latest/

Once that is done we can start installing the packages required by Subsonic. You can basically just copy paste the following commands.

Create folders and unpack Subsonic

Now its time to create the folders and download/extract subsonic standalone.

  • mkdir /var/subsonic
  • mkdir /var/subsonic/transcode
  • mkdir /var/subsonic/standalone
  • cp /usr/local/bin/lame /var/subsonic/transcode/
  • cp /usr/local/bin/flac /var/subsonic/transcode/
  • cp /usr/local/bin/ffmpeg /var/subsonic/transcode/
  • cd /tmp/
  • fetch http://heanet.dl.sourceforge.net/project/subsonic/subsonic/4.7/subsonic-4.7-standalone.tar.gz
  • cd /var/subsonic/standalone
  • tar xvzf /tmp/subsonic-4.7-standalone.tar.gz
  • chmod 777 *.*

If there were no errors during the install enter the following command while you are still inside the jail to see if subsonic starts.

  • sh /var/subsonic/standalone/subsonic.sh

If subsonic started as it should you can connect to it via the browser at the following adress: Jail-IP:4040, default username is admin, and password admin.

The finishing touches

And to make it run each time the Nas server is started we add it via the webgui under: System|Advanced|Command Scripts.

Command: jexec 1 /var/subsonic/standalone/subsonic.sh
Type: PostInit

Save and apply, and reboot your server. After a successful reboot you can check your Subsonic install via http://Jail-IP:4040

My Subsonic install had problems with the audio, the java install couldn’t see my audio dev. To solve this problem i installed alsa-plugins via the following command:

  • pkg_add -v -r alsa-plugins

Enjoy your new Subsonic server!

Advertisements

Tags: , , , , , , , , , , , , , , , , , , ,

About ado_dado

I'm 32, work as an Systemdeveloper. Work mostly with .NET (C#) i also spend a lot of time with my best friend my lovely little pitbull/amstaff mix "Chili" :) and the rest is spent on several projects that i am involved in during my spare time.

11 responses to “Subsonic install in FreeBSD jail”

  1. Diogo K says :

    Thanks man! Working almost everything. Only thing that’s weird it’s the System>Advanced>Command Scripts to autostart the jail and later the subsonic. Its configured to portinit but it does not start the jail and of course does not start the subsonic upon reboot. Weird.

    • ado_dado says :

      Thats an interesting problem, im at work at the moment but i will check out my jail start script and the autostart settings that i have on my nas4free set up and post it here later when i get home.

    • ado_dado says :

      Under System>Advanced>Command Scripts i have the following 2 scripts to start the jail and subsonic.

      mnt/data/jail/conf/jail_start
      /bin/sh /mnt/data/scripts/jailed_plugins_start.sh

      The jail_start script:
      #!/bin/tcsh -x
      #mounting to /jail
      mkdir /jail
      mount_nullfs /mnt/data/jail /jail
      # copy jail binaries to /usr, not needed if N4F is 454 or up
      # because Daoyama include needed files, uncomment if you use low .454
      version
      # cp -r /jail/conf/root/ /
      # link config files to /etc
      ln -s /jail/conf/rc.conf.local /etc
      mount -t devfs devfs /jail/plugins/dev
      #start all jails
      /etc/rc.d/jail start

      And my jail plugins script:
      #!/bin/sh
      echo “Subsonic Server and ClamAV Daemon start from Jail on NAS4Free 9.0.0.1.148 – 9.1.0.1.457.”
      jexec 1 /var/subsonic/standalone/subsonic.sh
      jexec 1 /usr/local/etc/rc.d/clamav-clamd onestart
      jexec 1 /usr/local/bin/freshclam -d -l /var/log/clamav/freshclam.log
      jexec 1 mixer ogain 75 pcm 74

      Compare the jail_start script to the one you have, if they are the same then it could be that it is not executable try running again the “chmod 755 /jail/conf/jail_start ” command to see if that helps.

  2. E. HoSang says :

    Can’t seem to find the lame file anywhere. Is there a new place?

  3. Jarod says :

    Thanks for posting this it saved me a lot of time … turn off brain and follow steps;) this was my first jail setup.
    I’m having sound issues though, I can listen through a web page but if I use players like Subclient no sound comes through. Yes speakers are turned on and I can hear sound coming from other programs and I did do the pkg_add -v -r alsa-plugins. When I ssh into the nas4free box and run “pciconf -lv | more” and it sees a HDA Intel audio chip. I don’t see any snd_hda.ko like files anywhere though; but, that probably makes sense because what does a NAS need with audio drivers. I’m new to FreeBSD in general so I’m kinda lost as to where to even start. Any ideas?

  4. Jarod says :

    I forgot to mention, the one deviation from your instructions was for:

    setenv PACKAGESITE ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-stable/Latest/

    I changed i386 to amd64 because mine is running on a 64bit machine.

    • Jarod says :

      err ah well that hurt my face a bit. It appears some clients seem to work and others do not. Subclient (http://www.subclient.net/) wasn’t working on my windows machine. I’m not sure why some work and some do not. If I figure it out and it may appear useful I will share.

  5. Indy says :

    In media folders i get “Folder not found

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: