Tuesday, 21 September 2010

How to install SABnzbd 0.5.4 on FreeNAS v0.7.1

Assuming IP of Freenas =
Assuming port of SABnzbd = 8080 (default per sabnzbd)
Assume that the everything is done through SSH unless mentioned otherwise.
This is for Full install only - embedded see this thread:https://sourceforge.net/apps/phpbb/freenas/viewtopic.php?f=15&t=4179
See Post #2 for some tricks and tips

Tested with FreeNAS 0.7.1 i386. The script should now fully support all architectures. 

The script has 3 options: Know good (hard coded link), latest stable version (dynamically updates when the script runs), latest beta version (same thing auto updates). All of these options should upgrade gracefully (go from stable to latest beta) and MAY downgrade gracefully.

Updated: 04/26/10

Credits: Grail (from LinuxQuestions), Ethan Spoelstra (ewspoelstra@computerphreaks.com)

Quick and easy method:

cd /root
fetch -o /root/sab.sh "https://sourceforge.net/apps/phpbb/freenas/download/file.php?id=1237"
chmod 0555 sab.sh


output from above commands: 
Copyright (c) 1980, 1983, 1986, 1988, 1990, 1991, 1993, 1994 The Regents of the University of California.  All rights reserved. Welcome to FreeNAS! server:~# cd /root/server:~# fetch -o /root/sab.sh "https://sourceforge.net/apps/phpbb/freenas/download/file.php?id=1237" /root/sab.sh                                  100% of 3644  B 4639 kBpsserver:~# server:~# chmod 0555 sab.shserver:~# ./sab.sh      *******Archeticture of Machine is amd64 *******          Latest SABnzbd Stable version is: 0.5.4         Latest SABnzbd Beta version is:            Which Version do you wish to Install?          ----- ------- -- --- ---- -- -------- [1] Upgrade/Install SABnzbd 0.5.0 (tested good)[2] Upgrade/Install latest STABLE SABnzbd 0.5.4[3] Upgrade/Install lastest BETA SABnzbd [4] Exit 2 *******Selected Option 2: Latest STABLE SABnzbd 0.5.4******* Downloading latest STABLE SABnzbd 0.5.4SABnzbd-0.5.4-src.tar.gz                      100% of 1376 kB 1514 kBps *******1. Installing the required prerequisites*******--Installing SABnzb (0.4.8)--Fetching ftp://ftp.freebsd.org/pub/FreeBSD/ports/amd64/packages-7.2-release/Latest/sabnzbdplus.tbz... Done.Fetching ftp://ftp.freebsd.org/pub/FreeBSD/ports/amd64/packages-7.2-release/All/python25-2.5.4_1.tbz... Done. ====Note that some of the standard modules are provided as separateports since they require extra dependencies: bsddb           databases/py-bsddbgdbm            databases/py-gdbmsqlite3 databases/py-sqlite3tkinter         x11-toolkits/py-tkinter Install them as needed.==== Fetching ftp://ftp.freebsd.org/pub/FreeBSD/ports/amd64/packages-7.2-release/All/py25-openssl-0.8_1.tbz... Done.Fetching ftp://ftp.freebsd.org/pub/FreeBSD/ports/amd64/packages-7.2-release/All/py25-cherrypy-old-2.3.0,1.tbz... Done.Fetching ftp://ftp.freebsd.org/pub/FreeBSD/ports/amd64/packages-7.2-release/All/py25-chardet-1.0.1.tbz... Done.Fetching ftp://ftp.freebsd.org/pub/FreeBSD/ports/amd64/packages-7.2-release/All/py25-feedparser-4.1_2.tbz... Done.Fetching ftp://ftp.freebsd.org/pub/FreeBSD/ports/amd64/packages-7.2-release/All/py25-utils-0.3.0.tbz... Done.Fetching ftp://ftp.freebsd.org/pub/FreeBSD/ports/amd64/packages-7.2-release/All/py25-setuptools-0.6c9.tbz... Done.Fetching ftp://ftp.freebsd.org/pub/FreeBSD/ports/amd64/packages-7.2-release/All/py25-elementtree-1.2.6.tbz... Done.Fetching ftp://ftp.freebsd.org/pub/FreeBSD/ports/amd64/packages-7.2-release/All/py25-cheetah-2.0.1.tbz... Done.Processing Cheetah-2.0.1-py2.5-freebsd-7.2-RELEASE-amd64.eggAdding Cheetah 2.0.1 to easy-install.pth fileInstalling cheetah-compile script to /usr/local/binInstalling cheetah script to /usr/local/bin Installed /usr/local/lib/python2.5/site-packages/Cheetah-2.0.1-py2.5-freebsd-7.2-RELEASE-amd64.eggFetching ftp://ftp.freebsd.org/pub/FreeBSD/ports/amd64/packages-7.2-release/All/py25-cElementTree-1.0.5_1.tbz... Done.Fetching ftp://ftp.freebsd.org/pub/FreeBSD/ports/amd64/packages-7.2-release/All/unrar-3.80,5.tbz... Done.Fetching ftp://ftp.freebsd.org/pub/FreeBSD/ports/amd64/packages-7.2-release/All/par2cmdline-0.4_2.tbz... Done.--Installing py25-yenc--Fetching ftp://ftp.freebsd.org/pub/FreeBSD/ports/amd64/packages-7.2-release/Latest/py25-yenc.tbz... Done.--Installing unzip--Fetching ftp://ftp.freebsd.org/pub/FreeBSD/ports/amd64/packages-7.2-release/Latest/unzip.tbz... Done.--Installing py25-pysqlite-2.3.5--Fetching ftp://ftp.freebsd.org/pub/FreeBSD/ports/amd64/packages-7.2-release/All/py25-pysqlite-2.3.5.tbz... Done.Fetching ftp://ftp.freebsd.org/pub/FreeBSD/ports/amd64/packages-7.2-release/All/pkg-config-0.23_1.tbz... Done.Fetching ftp://ftp.freebsd.org/pub/FreeBSD/ports/amd64/packages-7.2-release/All/sqlite3-3.6.11.tbz... Done.--Starting SABnzbd (to generate config file)----Shutting down SABnzb--fetch: http://localhost:8080/sabnzbd/api?mode=shutdown: Connection refused*******2. Removing outdated files/folders*******--done--*******3. Extracting updated version of SABnzbd*******--Extracting upgrade----Extracted upgrade----done--*******4. Moving/Installing newer version of SABnzbd*******--done--*******5. Deleting extra files*******--done--*******Done - SABnzbd should be installed*******

Then do steps 6-8 from below:

Manual Method (may work better for some):
1. Installing the required prerequisites (and generating config file)

pkg_add -r sabnzbdplus
pkg_add -r py25-yenc
pkg_add -r unzip
pkg_add -r "ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-7.2-release/All/py25-pysqlite-2.3.5.tbz"
/usr/local/bin/SABnzbd.py -d -f /root/.sabnzbd/sabnzbd.ini 
/usr/bin/fetch "http://localhost:8080/sabnzbd/api?mode=shutdown"

2. Removing outdated files/folders

rm -rf /usr/local/lib/python2.5/site-packages/cherrypy
rm -rf /usr/local/lib/python2.5/site-packages/sabnzbd
rm -rf /usr/local/share/sabnzbdplus/interfaces
rm -rf /usr/local/share/sabnzbdplus/language
rm -rf /usr/local/bin/SABnzbd.py

3. Downloading upgraded version of SABnzbd (0.5.0) and extracting

cd /root/
fetch "http://downloads.sourceforge.net/project/sabnzbdplus/sabnzbdplus/sabnzbd-0.5.0/SABnzbd-0.5.0-src.tar.gz"
tar -xzf SABnzbd*
cd SABnzbd*

4. Moving/Installing newer version of SABnzbd

mv cherrypy /usr/local/lib/python2.5/site-packages/cherrypy
mv sabnzbd /usr/local/lib/python2.5/site-packages/sabnzbd
mv interfaces /usr/local/share/sabnzbdplus/interfaces
mv language /usr/local/share/sabnzbdplus/language
mv SABnzbd.py /usr/local/bin/SABnzbd.py
chmod 0555 /usr/local/bin/SABnzbd.py
ln -s /usr/local/bin/python2.5 /usr/bin/python
ln -s /usr/local/share/sabnzbdplus/interfaces /usr/local/bin/interfaces
ln -s /usr/local/share/sabnzbdplus/language /usr/local/bin/language

5. Deleting extra files

cd /root/
rm  SABnzbd*.gz
rm -rf SABnzbd*

SABnzbd in now installed. We now need to configure a few minor things:

6. Set proper IP in sabnzbd.ini

nano /root/.sabnzbd/sabnzbd.ini
Replace the localhost in the "host =" spot to be your freenas box IP. Would look like this:
/root/.sabnzbd/sabnzbd.ini wrote:host =

7. Start updated SABnzbd for the first time
From SSH run the following command
/usr/local/bin/SABnzbd.py -d -f /root/.sabnzbd/sabnzbd.ini
Access SABnzbd via the following address (on your desktop machine):
Go through the basic install wizard. Once completed it will update the sabnzbd.ini file (config file)

8. Add startup and shutdown scripts (so FreeNAS knows to turn SABnzbd on and off)
Obtain your unique SABnzbd "API Key" from this page: - Add this key to the SHUTDOWN command below (where it say APIKEY; replace it with your API key)
Add the following entries to your System|Advanced|Command scripts section of FreeNAS web interface (
/usr/local/bin/SABnzbd.py -d -f /root/.sabnzbd/sabnzbd.ini
Type: Shutdown
/usr/bin/fetch "" >/dev/null

Script version of commands 1-5 (6-8 need to be done by hand)

(3.56 KiB) Downloaded 1153 times


  1. Awesome work! :-) Spent a while trying to install new Sabnzbd on Full FreeNas

    I wasn't able to install Sabnzbd directly using your script, but with a few edits it works great. Since your post, some of the links to python 2.5 are no longer around. I had to edit them to reflect the 2.6 versions. The line to change directory to the untarred SABnzbd dir failed also - line 94 "CD SABnzbd*" - so I edited it to the exact directory name. So far I've tested it on SABnzbd 0.5.0. I hope this info saves someone as much time as you have saved me! Thanks

  2. Just tested installing Sabnzbd 0.5.6 on Full FreeNas and works great. I am no programmer, but I'm sure theres an easy solution to fixing line 94 so it changes directory to the correct directory for the version selected in beginning. For now, just edit top reflect sabnzbd tar dir. Not sure the command to shutdown Sabnzbd 4.x is working right, but seems to work anyways. :-)

  3. erm i might be a bit daft, but the hardcoded path to 7.2 releases are no longer present at any server... what path to use instead?
    Eg. the script cant find any of the dependent files needed from the 7.2 release-path, neither does any py-related file download