fantechtic

About technology, life and other useful stuff.
Oct 12
Permalink

[Tutorial] SABnzbd on embedded FreeNAS 0.7.2 (i386)

Here it is. Yet another tutorial on how to install SABnzbd on your FreeNAS with embedded install. Because I used a few additional or different steps than most tutorials I’ve read through, I’ve decided to write my own tutorial.

UPDATE 18dec. 2010
- Using SABnzbd 0.5.6
- Using FreeBSD 7.3 packages instead of 7.2.
- Python 2.6.4 install included (for CouchPotato and future use). 

UPDATE 16oct. 2010
- Everything fixed and tested. Have fun!

Most of you who come to this page should have a bit of knowledge about what SABnzbd is. For those who don’t, a brief explanation. SABnzbd is a usenet download tool, just like Grabit or Newzleecher. The cool thing about SABnzbd is that it does everything for you: you upload an NZB file to SABnzbd (via one of the many ways) and it will begin downloading the files from usenet. Afterwards it checks your files (Parity check), optionally repairs and unpacks them. Just let it run and view your files afterwards! And all by using a customizable web-interface that can be accessed from anywhere by (almost) every device that has internet on it. Pretty cool huh?

[NOTES]

- For big commands, split up in 2 or 3 lines, copy and paste them in a text-editor first. To make sure you get command right as it should (with spaces, etc.).

- This tutorial is based on this tutorial with a few minor adjustments.

We will be using a custom mount named “Zeta" which will be named several times throughout the tutorial. Change this with your own mount name. Mounts can be created and modified using the Disks > Mount menu at the FreeNAS web-interface.

Of course change the ip address stated in the tutorial with your own FreeNAS ip address.

1. Open a SSH connection to your FreeNAS box using Terminal (OSX) or Putty (Windows).
In OSX this is done by opening terminal and typing:

ssh -l root 192.168.1.250

(login with your admin password)

2. Because we can’t install any additional packages on the FreeNAS embedded install, we are going to create some custom install directories on our harddrive. Also we will create a folder to store the SABnzbd config file.

cd /mnt/Zeta

mkdir extensions

cd extensions 

mkdir sabnzbd

mkdir var

mkdir usr

mkdir tmp

3. Before we go to the next step, go into the FreeNAS web-interface and create the group: “sabnzbd”. Then assign some users to the group, which are going to access the folder.

4. Next we’re creating the SABnzbd download folders (of course you can change them to your own likings). 

cd /mnt/Zeta

mkdir downloads

chgrp sabnzbd downloads

chmod 770 downloads

cd /mnt/Zeta/downloads

mkdir blackhole

mkdir complete

mkdir incomplete

mkdir scripts

chgrp -R sabnzbd blackhole

chgrp -R sabnzbd complete

chgrp -R sabnzbd incomplete

chgrp -R sabnzbd scripts

chmod 770 blackhole

chmod 770 complete

chmod 770 incomplete

chmod 770 scripts

5. Then link the default package installation folders to the previously created ones:

mount_unionfs -o w /mnt/Zeta/extensions/usr/ /usr/

umount -f /var

mount_unionfs -o w /mnt/Zeta/extensions/var/ /var/

setenv PKG_TMPDIR /mnt/Zeta/extensions/tmp/

6. Install packages required by SABnzbd:
(note: if you can’t install packages you’ll have to set your DNS servers to -for example- this OpenDNS servers: 208.67.222.222 and 208.67.220.220. At your FreeNAS web-interface >System > General

setenv PACKAGESITE “ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-7.3-release/All/”

pkg_add -rv python26-2.6.4 py26-sqlite3-2.6.4_1

pkg_add -rv unzip-6.0

pkg_add -rv py26-yenc-0.3

pkg_add -rv py26-cheetah-2.4.1_1

pkg_add -rv py26-openssl-0.10

pkg_add -rv py26-feedparser-4.1_2

pkg_add -rv py26-utils-0.3.0

pkg_add -rv unrar-3.91,5

pkg_add -rv par2cmdline-0.4_2

7. If everything went well, install SABnzbd:

cd /mnt/Zeta/extensions/tmp/

fetch “http://downloads.sourceforge.net/project/sabnzbdplus/sabnzb
dplus/sabnzbd-0.5.6/SABnzbd-0.5.6-src.tar.gz”

tar -xzf SABnzbd-0.5.6-src.tar.gz

rm  SABnzbd-0.5.6-src.tar.gz

mv SABnzbd-0.5.6 /usr/local/share/

8. Change the SABnzbd python script to point out to the correct Python install dir:

nano /usr/local/share/SABnzbd-0.5.6/SABnzbd.py

8.1. Modify: “!/usr/bin/python” to: “!/usr/local/bin/python”
Next press CTRL+X to exit, Y to overwrite and ENTER to confirm the filename. 

9. Now we’re going to add the system folder links and SABnzbd to the FreeNAS startup scripts.
Go to your FreeNAS web-interface and to Advanced > Startup scripts.

Choose the “+” icon and enter these commands: (save after each command)

mount_unionfs -o w /mnt/Zeta/extensions/usr/ /usr/

Type: PostInit

(This command will make sure the system folder “usr” gets redirected to your harddrive.)

/usr/local/share/SABnzbd-0.5.6/SABnzbd.py -d -f /mnt/Zeta/extensions/sabnzbd/sabnzbd.ini -s 192.168.1.250:8085

Type: “PostInit”

10. Save and then reboot your FreeNAS system. After reboot is completed, try loggin in on the SABnzbd webinterface: http://192.168.1.250:8085/sabnzbd

10.1 Now go to Advanced > Startup scripts again and this one for shutdown:

/usr/bin/fetch “http://192.168.1.250:8085/sabnzbd/shutdown?session=myapikey” > /dev/null

Type: “Shutdown”

(note: replace “myapikey” with your SABnzbd API key, found in SABnzbd > Config > General. Replace IP address with your own.)

11. In SABnzbd > Config > Folders enter the previously created folder directories in absolute format.
For example:
Temporary Download Folder: 

/mnt/Zeta/downloads/incomplete

12. Set “Permissions for completed downloads” to:

777

Save changes afterwards.

You’re done!
Have fun and report any problems or comments below, thanks :)

- Be sure to check out this work-in-progress freeNAS dashboard - 

  1. cosplay-shopper reblogged this from rogervaessen
  2. rogervaessen posted this
blog comments powered by Disqus