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.

Prerequisites

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.

Procedure

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/SABnzbd.py -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 10.2.64.251. 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/SABnzbd.py -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/SABnzbd.py -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.

No comments:

Post a Comment