Thursday, 23 September 2010

How to install SABnzbd+ on FreeNAS (Official Guide)

Installing Sabnzbd

This guide was written using FreeNAS i386 0.69 and VirtualBox 3.2.4 r62467. The steps involved should all work on the latest version of FreeNAS, but your mileage may vary.


This guide has been written for users with no knowledge of BSD and who don't have or necessarily know how to use SSH. If there is something in this guide that is unclear please correct it. This guide assumes you know what Sabnzbd is. If not, why are you trying to install it?
You will need about 500MB free on the OS partition (/) as the Python install requires around 500MB of temporary disk space. The final usage after this procedure will be about 150MB. You will also need your FreeNAS server configured with a static IP (not DHCP) to use Sabnzbd.


Adding par2cmdline1. Install the following packages. In the Web GUI go to System → Packages and click the +. Add each of the listed packages using the interface here. Because of their dependencies you will need to add them in the order below. An archive of all the required packages can be downloaded here.1) If the addition of a package is successful you should see something like the image on the right.
  • par2cmdline
  • python25
  • py25-elementtree
  • py25-cElementTree
  • py25-chardet
  • py25-setuptools
  • py25-cheetah
  • py25-cherrypy-old
  • py25-feedparser
  • py25-openssl
  • py25-utils
  • unrar
  • unzip
  • sabnzbdplus
All Sabnzbd Dependencies Added
2. Create a new user to run Sabnzbd. It's a security risk to run Sabnzbd as root, which is what most tutorials advise you to do. Using the Web GUI go to Access → Users and Groups and add a new user called sabuser. Set their primary group as admin, home directory as /home/sabuser and check give full shell access to user. Make sure you click the Apply Changes button after this to create the user.Create New User
3. Allow the new user to write to the temporary directory. When you upload an NZB file via the web interface, Sabnzbd saves the NZB to /tmp while working with it. Using the Web GUI go to Advanced → Command. Enter chmod o+w /tmp and click the Execute button. If all goes well this command will return nothing.Chmod Output
4. Run Sabnzbd once to generate the configuration settings. Using the Web GUI go to Advanced → Command. Enter the command su - sabuser -c "/usr/local/bin/ -d -f /home/sabuser/.sabnzbd/sabnzbd.ini". This should return nothing as shown below.Sabnzbd Start
Now we need to stop the Sabnzbd process that's running in the background. Using the command interface run the command ps aux | grep sabuser and note the process ID in the second field on the line beginning with sabuser.Ps Output
Next run the command kill pid, replacing pid with the ID you noted in the output of ps aux | grep sabuser. If all goes well this will return nothing.Kill Output
5. Edit the Sabnzbd configuration file to insert your server's IP. Using the Web GUI go to Advanced → File Editor and load the file /home/sabuser/.sabnzbd/sabnzbd.ini. Locate the line the reads ”host = localhost” and change this to read ”host = IP” where IP is your server's IP address. In my example, my server is Click the Save button after you have made this change.Editing Sabnzbd Configuration
6. Add a PostInit command to start Sabnzbd. Using the Web GUI go to System → Advanced → Command Scripts. Add a PostInit command that does su - sabuser -c "/usr/local/bin/ -d -f /home/sabuser/.sabnzbd/sabnzbd.ini" as shown in the screenshot.2)PostInit Command
7. Start Sabnzbd. To do this you can either restart your FreeNAS server (which will trigger the PostInit command) or go to Advanced → Command and execute su - sabuser -c "/usr/local/bin/ -d -f /home/sabuser/.sabnzbd/sabnzbd.ini" again.
And you're done! You can access the web interface for Sabnzbd at http://IP:8080/sabnzbd where IP is your server's IP address. You can make any other changes to the Sabnzbd configuration through this interface.
1) If you are using a later version of FreeNAS than 0.69 you will need to add the appropriate packages for your underlying FreeBSD version and architecture. That is beyond the scope of this tutorial.
2) At this point most guides direct you to create a Shutdown command to exit Sabnzbd when your server is shutting down. All the commands I have seen recommended are incorrect, but moreover this step is not necessary. Sabnzbd correctly catches SIGTERM when your server is shutting down and exits cleanly.

Wednesday, 22 September 2010

How to add SABnzbd+ to FreeNAS WebGUI

This little script will add a menu item to your FreeNAS WebGUI.

Open an SSH session to your FreeNAS box - (ssh root@

cd /rootfetch -o /root/ ""unzip sabnzbd.zipchmod 0555 ./SABnzbdExt/

If your server is on a port, something other than 8080, you will need to edit the extensions_sabnzbd.php  file. 

cd /rootnano ./SABnzbdExt/sabnzbd/extensions_sabnzbd.php


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:
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 (

Quick and easy method:

cd /root
fetch -o /root/ ""
chmod 0555


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/ "" /root/                                  100% of 3644  B 4639 kBpsserver:~# server:~# chmod 0555 sab.shserver:~# ./      *******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 Done.Fetching 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 Done.Fetching,1.tbz... Done.Fetching Done.Fetching Done.Fetching Done.Fetching Done.Fetching Done.Fetching 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 Done.Fetching,5.tbz... Done.Fetching Done.--Installing py25-yenc--Fetching Done.--Installing unzip--Fetching Done.--Installing py25-pysqlite-2.3.5--Fetching Done.Fetching Done.Fetching 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 ""
/usr/local/bin/ -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/

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

cd /root/
fetch ""
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 /usr/local/bin/
chmod 0555 /usr/local/bin/
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/ -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/ -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