How To Turn Your FreeNAS Box Into An Internet PVR With SABnzbd And Sick Beard

So you’ve set up your own NAS, and you’d like it to download more than just the occasional torrent. If you’d like to automatically download TV shows as soon as they’re available with previously mentioned Sick Beard, you can install it to your NAS for an always-on internet PVR.

If you’d rather not keep your main machine on all day waiting for new TV shows to download, installing Sick Beard on a NAS is a fantastic way to automatically download your favourite TV shows, whether your other computers are already on or not. However, installing SABnzbd and Sick Beard to a NAS takes a bit more work than installing it to a normal computer. Here’s how to do it.

I owe a lot of this information to Roger Vaessen over at his blog Fantechtic, so check out his original SABnzbd and Sick Beard guides for more information.

What You Need to Know Before Proceeding

This is a rather advanced process, so you’ll need to be comfortable entering terminal commands to do this. As long as you follow the instructions to the letter, though, you shouldn’t find it too hard.

This guide assumes you’re using FreeNAS 0.7.2, the UFS filesystem, and a static IP as described in our original guide. The static IP address is very important; if you aren’t using one, you might not be able to connect to the internet.

I’m also assuming you’re familiar with the basic concepts of Usenet and Sick Beard. If you aren’t, check out our original Usenet guide and our original Sick Beard guide before proceeding. This guide won’t show you how to use them, just how to install them on a FreeNAS box.

Once you’ve read all those guides closely, continue with the steps below to install SABnzbd and Sick Beard on your NAS.

Installing SABnzbd

SABnzbd, as you know, is the program we use to actually download files from Usenet. Installing it in FreeNAS is all done from the Terminal. You can either do this from your FreeNAS box itself, or by SSHing into it from another computer (which I prefer).

To SSH into your NAS, either download PuTTY for Windows or open up a Terminal in OS X. In PuTTY, just type in the IP address of your NAS on the main page and hit Open. You’ll want to log in as root and type in the password you created for yourself when you set up the NAS. If you’re on OS X, type this command into the Terminal and hit Enter.

ssh -l root 192.168.0.10

Where 192.168.0.10 is the IP address of your NAS. Then, follow the instructions below.

Step One: Create the Necessary Folders

We can’t actually install these programs directly onto the same drive as FreeNAS, so we’re going to install it on one of the drives in our NAS. In my case, I installed it on the same drive where I store all my movies and TV shows, in a folder called “Extensions”. My media drive is called SEAGATE, so whenever you see that in the commands below, replace it with the mount name of your own drive.

To start, we’re going to create the folders we need to get SAB up and running. Run the following commands in the terminal, hitting Enter after each one:

cd /mnt/SEAGATE
mkdir extensions
cd extensions
mkdir sabnzbd
mkdir var
mkdir usr
mkdir tmp

These are the folders required by the program to run. We’ll also create SABnzbd’s download folders. If you prefer, you can do all this from Windows Explorer or the Finder too, but while you’re sitting at the terminal, you can create them (and give yourself permission to access them) with these commands:

cd /mnt/SEAGATE
mkdir Downloads
chmod 777 Downloads
cd /mnt/SEAGATE/Downloads
mkdir Blackhole
mkdir Complete
mkdir Incomplete
mkdir Scripts
chmod 777 Blackhole
chmod 777 Complete
chmod 777 Incomplete
chmod 777 Scripts

If you’re rather security conscious about your TV shows (I’m not), you can change these permissions to something more strict than 777, or even restrict a group of users to accessing SABnzbd as described in the original guide. I don’t find any of this necessary on my own home network, so I won’t get into it here.

Lastly, we’ll want to link a few of FreeNAS’ system folders to the folders we just created with the following commands:

mount_unionfs -o w /mnt/SEAGATE/extensions/usr/ /usr/
umount -f /var
mount_unionfs -o w /mnt/SEAGATE/extensions/var/ /var/
setenv PKG_TMPDIR /mnt/SEAGATE/extensions/tmp/

Step Two: Install the SABnzbd Packages

Next, we’re going to actually install SABnzbd on our system. If you have any trouble, double check this page and make sure the following commands’ version numbers are all up to date, as these things can change over time.

Install the prerequisite Python packages first:

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

If you’re using a 64-bit version of FreeNAS, change i386 in the first command to amd64. If this all worked with no errors, you can install SABnzbd itself with:

cd /mnt/SEAGATE/extensions/tmp/
fetch “http://downloads.sourceforge.net/project/sabnzbdplus/sabnzb
dplus/sabnzbd-0.6.8/SABnzbd-0.6.8-src.tar.gz”
tar -xzf SABnzbd-0.6.8-src.tar.gz
rm SABnzbd-0.6.8-src.tar.gz
mv SABnzbd-0.6.8 /usr/local/share/

Lastly, you’ll want to change the Python directory in SABnzbd’s python script. Run the following command:

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

and on the first line, change #!/usr/bin/python to #!/usr/local/bin/python. Hit Ctrl+X to exit, and confirm the save with Y. Congratulations! SABnzbd is now installed on your system.

Step Three: Set SABnzbd to Start Up With Your NAS

You probably won’t reboot your NAS often, but we’re going to set a few startup and shutdown commands to keep SABnzbd running whenever your NAS is. Head into FreeNAS’ web interface and go to System > Advanced > Command Scripts. Click the plus sign and add these two commands as “PostInit” commands:

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

and

/usr/local/share/SABnzbd-0.6.8/SABnzbd.py -d -f /mnt/SEAGATE/extensions/sabnzbd/sabnzbd.ini -s 192.168.0.11:8085

Replacing 192.168.0.11 with the IP address of your NAS. Restart your NAS and head to http://192.168.0.11:8085/sabnzbd, replacing 192.168.0.11 with the IP address of your NAS. If everything went well, the SABnzbd web interface should pop up, ready for you to add NZBs to download!

Lastly, head back into the FreeNAS web interface add the following command alongside the others, only this time as a “Shutdown” command:

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

where APIKEY is your SABnzbd API key, which you can find in SABnzbd’s web interface under Config > General.

When you set up SABnzbd, you’ll need to enter your download folders in absolute format, that is starting with /mnt/. For example, your “Complete” folder should be /mnt/SEAGATE/Downloads/Complete instead of just Complete. In addition, you’ll want to set the permissions of your completed downloads to 0777 so you can access them. For more information on how to set up SAB, check out our original guide to getting started with Usenet.

Installing Sick Beard

Like SABnzbd, we’re going to install Sick Beard through the terminal. These instructions assume you already installed SABnzbd on the NAS, so follow those instructions before these. Either hook a keyboard up to your NAS or SSH into your NAS as described above, and follow the steps below to install Sick Beard.

Step One: Create the Necessary Folders

We’re going to install Sick Beard in the extensions folder we created when we installed SABnzbd. You’ll want to create a folder inside extensions for Sick Beard:

cd /mnt/SEAGATE/extensions

mkdir sickbeard

chmod 777 sickbeard

Again, if you prefer stricter permissions, you can edit the chmod command accordingly.

Step Two: Install Sick Beard

To download and extract the latest version of Sick Beard, just run the following commands:

fetch “http://github.com/midgetspy/Sick-Beard/tarball/master”
tar -xzf master
rm master

Run the following command to find out the name of the resulting folder:

ls

There should be a folder called midgetspy-Sick-Beard-e0e8f0e, or something similar (your folder name may vary). Make note of this, and then move it into the Sick Beard folder:

mv midgetspy-Sick-Beard-e0e8f0e /mnt/SEAGATE/extensions/sickbeard

That’s it. There’s no “installation”, since Sick Beard is really just a set of Python scripts. To start it up, just run:

python /mnt/SEAGATE/extensions/sickbeard/midgetspy-Sick-Beard-e0e8f0e/SickBeard.py

You should be able to access it from any browser by going to http://192.168.0.11:8081/home, replacing 192.168.0.11 with the IP address of your NAS.

Step Three: Set Sick Beard to Start Up With Your NAS

Like SABnzbd, we’re going to start up Sick Beard with the NAS and shut it down when your NAS does. Type the following commands to edit Sick Beard’s shut down script:

cd /mnt/SEAGATE/extensions/sickbeard
nano sd.sh

Paste the following code into the editor that appears, replacing your IP address on the first line, your Sick beard username on the second line, and your Sick Beard password on the third line (you can create a username and password for Sick Beard from its web interface):

#!/bin/sh
fetch “http://192.168.0.11:8081/home/shutdown/ «_EOF
yoursickbeardUSERNAMEhere
yoursickbeardPASSWORDhere
_EOF

Hit Ctrl+X to exit, and Y to save your changes. Make that script executable by running the following command:

chmod +x sd.sh

Lastly, head back into FreeNAS’ web interface, and go to System > Advanced > Command Scripts. Click the plus sign and add this as a “PostIinit” command:

/mnt/SEAGATE/extensions/usr/local/bin/python2.5 /mnt/SEAGATE/extensions/sickbeard/midgetspy-Sick-Beard-e0e8f0e/SickBeard.py –quiet &

Add the following command as a “Shutdown” command as well:

/mnt/SEAGATE/extensions/sickbeard/sd.sh

Now you’re done! SABnzbd and Sick Beard will start up with your NAS, and you can control them both from any computer in the house. Remember, as you set up Sick Beard, to use absolute file paths in all the settings — like /mnt/SEAGATE/Downloads/Complete instead of just Complete — otherwise you’ll run into a wall where SAB and Sick Beard won’t know where to save your files.

Finishing Touches

I won’t go into how to use SAB and Sick Beard here, because once again, we’ve done a lot of that before. Check out our Usenet guide for more info on using SABnzbd, and our Sick Beard guide to using Sick Beard. I also highly recommend checking out this Sick Beard guide from our friends over at the How-To Geek — they go into a lot of detail about how to send TV shows from Sick Beard to SAB, and even how to integrate XBMC. It’s a really great help to those getting started.

If you end up using the sabtosickbeard.py script in Sick Beard, as described in the guide at How-To Geek, make sure you edit sabtosickbeard.py in your favourite text editor (you should be able to access it from any computer through Windows Explorer) and change the first line to:

#!/usr/local/bin/python

And be sure to check out Roger’s original Sick Beard guide if you have trouble getting it set up on the NAS.

That’s it! It seems very long and complicated, but as long as you enter the terminal commands correctly, it shouldn’t actually give you much trouble. Once again, I’ve edited this post a little bit for clarity, but all the credit goes to Roger, who figured it out and wrote the original guides. If the instructions work for you, head over there and give him a shout out in the comments to thank him. Be sure to let us know if it worked for you, too, in the comments below.


The Cheapest NBN 50 Plans

Here are the cheapest plans available for Australia’s most popular NBN speed tier.

At Lifehacker, we independently select and write about stuff we love and think you'll like too. We have affiliate and advertising partnerships, which means we may collect a share of sales or other compensation from the links on this page. BTW – prices are accurate and items in stock at the time of posting.

Comments


9 responses to “How To Turn Your FreeNAS Box Into An Internet PVR With SABnzbd And Sick Beard”

Leave a Reply