SABnzbd & Sickbeard on FreeNAS
One of the things my NAS at home does is Downloading! I am using SABnzbd as a the download engine. This tool connects to the usenet provider and can download and unpack files even with the use of PAR files (parity recovery files to repair broken blocks in the packed files). We only need to feed it .NZB files. These NZB files are XML-based file format for retrieving posts from usenet. I am also using Sickbeard to automatically download my favorite series. The following guide is an complete configuration and setup of those tools. The guide consist of a few main items for both SABnzbd and Sickbeard
- Installing the plugin’s
- Assigning storage and start SABnzbd
- Setting up SABnzbd
- Resolve an issue with permissions inside the SABnzbd Jail
- Configuring directories for SABnzbd
- Assigning storage and start Sickbeard
- Resolve an issue with permissions inside the Sickbeard Jail
- Setting up Sickbeard
- Configuring directories for Sickbeard
- Creating categories in SABnzbd for Sickbeard
This guide is a follow-up of the “installing FreeNAS“. In that post we not only installed FreeNAS but we also created storage space, users, groups and shares. In this guide I assume that you setup these already.
Installing the Plugin’s
We start with the installation of the Plug-in’s
- Navigate to “Plugins” and select “SABnzbd”
- At the bottom of this page is the “install” button.
- It takes a few minutes to install but after the pop-up box disappears, you can see under the tab “Installed” that its there along with its version though the “status” is Off
- Do the same steps for “Sickbeard”
- Do NOT start the plugin’s yet!
You can change the default IP where the services are running (optional)
- Navigate to “Jails” on the left side of the screen and collapse “sabnzbd_1” or “Sickbeard_1” . Select the “Edit” button
- Set the desired IP using a free address in the same network; in my example 192.168.1.x (where x is a free address)
- Hit the “save” button if you are ready
Assigning storage and start SABnzbd
Before you start the plug-in, we have to link storage to the plug-in Jail.
- Navigate to “Jails” and collapse the new jail named “sabnzbd_1”. Collapse the “Storage” box and hit “Add Storage”.
- Here we are going to create a XXXXX where we will map our storage directory to a directory in the Jail
- In my example the source is our created storage [/mnt/RaidZ/Media]. This folder “Media” we created in step XXXX from XXXX. I want to map this folder to the Jail in the destination tab [/media]
- Start the Service by going back to “plugins” and navigate to the tab “Installed” where you can klik on the Service Status.
Setting up SABnzbd
- By default the SABnzbd service is running on port 8080 on the IP address
in the jail. If you did not change the IP in step XXX from XXX you can check where its running by navigating to “Plugins” on the left side of the screen and hit “SABnzbd”. In the pup-up the link is highlighted and will take you to the quick-start Wizard. You can also navigate directly to http://THE-SABNZBD-IP:8080/wizard/
- Walk true the wizard by selecting the language as the very first step
- The second step is your usenet account page. This information you will be getting from your usenet provider. My provider is supporting SSL which I find important. Not only is my login information unencrypted if you do not use SSL, the biggest issue is that everyone can see what you are downloading and how many… So I do recommend using SSL if at all possible
- The next step is “Access”, as its my internal home network I allow everyone to view SABnzbd and I don’t use a username and password. This means that the default settings are just fine.
- Step three is connecting to an Indexer (ozndb.com)
- That’s it for the setup. The service will reboot and you will see a screen with the links to the service. I am always using the IP address link
Resolve an issue with permissions
Before we are going to configure directories, I discovered an issue while trying to create folders from the SABnzbd plug-in where the script was unable to write to the folders nor it was able to create directories. [Cannot create directory /media/Downloads/Incomplete]. I discovered that the user (inside the Jail) was unable to write to any of the directories because it was unknown to the FreeNAS users and groups. I fixed it with the following actions;
- We have to create a user with the same UID as the user inside the Jail. I discovered that the SABnzbd script is usign a user insde the Jail called “Media” with UID 816
- Navigate to “accounts”” and collapse “Users”. Hit the “Add Users” and use the username “media” with the “User ID” 816 (the same UID as inside the Jail). Put the user in “primary Group” “users” we created in step XXX using XXX
- Now we have to add the group “users” inside the jail. This can not be done from the GUI and we have to start a CLI (Command Line Interface) session. In the “Service” menue from the FreeNAS GUI make sure we have “SSH” ON so we can connect to the FreeNAS CLI. My favourite SSH client is Putty (http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html). Just download the executable (putty.exe) and start it. In the “host name” field fill out the IP address of the FreeNAS server (not the IP from the SABnzbd service) and hit “open”.
- First check what jail id the SABnzbd is using with the command [jls -v] (Mine is using JID 3).
[root@freenas] ~# jls -v JID Hostname Path Name State CPUSetID IP Address(es) 3 sabnzbd_1 /mnt/RaidZ/jails/sabnzbd_1 sabnzbd_1 ACTIVE 2
- Now connect to the jail that is running SABnzbd and notice that the prompt is changing from “freenas” (my hostname for my NAS) to the hosname from the jail
[root@freenas] ~# jexec 3 csh root@sabnzbd_1:/ #
- Now we need to add a group with a matching GID as the group owner of the data dataset/folders which is "users" in our case with GID (Group ID) 1001
root@sabnzbd_1:/ # pw groupadd -n users -g 1001
- We need to add the "Media" users that is running the plugin to the newly added group.
root@sabnzbd_1:/ # pw groupmod users -m media
- That was the complex part. You can use the command [exit] to get out of the Jail and use [exit] again to close the SSH session.
- Now we need to restart the service (navigate to "Plugins" and "Installed" where you can set the service OFF and ON again)
Configuring directories for SABnzbd
- Lets create some directory structure for our downloads. I have mounted my "Media" share to my Z drive. I just created a few folders like shown in my folder setup below;
PS C:\Users> tree z:\ Folder PATH listing for volume Media Volume serial number is BE9B-ED4E Z:\ ├───Documentaries ├───Downloads ├───Photos ├───Movies ├───Kids └───Series
- Now we need to setup the directories for downloading in SABnzbd. Navigate in SABnzbd to "Config" and open up the "Folders" view on the left side of the screen.
- The default base folder (/var/db/sabnzbd) is inside the Jail and therefore not accessible by our created shares. We need to change it to our created XXX in step XXX
- we are going to change the "Temporary Download Folder", "Completed Download Folder" and the "Watched Folder". If you hit "browse" after those three you can navigate to the Jail layout. Here you will find the [/media/Downloads] we created earlier.
- That's it for the configuration. You can check to see if everything is working by putting a .nzb file in de share.
Assigning storage to Sickbeard
Before you start the plug-in, we have to link storage to the plug-in Jail.
- Navigate to "Jails" and collapse the new jail named "sickbeard_1". Collapse the "Storage" box and hit "Add Storage".
- Here we are going to create a symbolic link where we will map our storage directory to a directory in the Jail
- In my example the source is our created storage [/mnt/RaidZ/Media]. This folder "Media" we created in step XXXX from XXXX. I want to map this folder to the Jail in the destination tab [/media]
- Start the Service by going back to "plugins" and navigate to the tab "Installed" where you can klik on the Service Status
Resolve an issue with permissions
Here we have the exact same problem as we have during our setup of SABnzbd. So we need to preform the exact same steps we did during the first session. Instead of going it step by step I've just posted my terminal output below. The only thing different is the jail we have to connect to. That was number 3 in SABnzbd and now number 4 for sickbeard
login as: root email@example.com's password: Last login: Mon Dec 7 10:57:43 2015 from 192.168.1.103 FreeBSD 9.3-RELEASE-p28 (FREENAS.amd64) #0 r288272+4d913dc: Fri Nov 27 22:56:01 2015 Welcome to FreeNAS [root@freenas] ~# jexec 4 csh root@sickbeard_1:/ # root@sickbeard_1:/ # pw groupadd -n users -g 1001 root@sickbeard_1:/ # pw groupmod users -m media root@sickbeard_1:/ # exit exit [root@freenas] ~# exit
Setting up Sickbeard
- We need to tell Sickbeard to use SABnzbd as a download engine. Do this by navigating in Sickbeard to "Config" and select "Search Settings". We need to select "SABnzbd" as our "NZB Method"
- We need to fill out the "SABnzbd URL" to point towards the SZBnzbd instance. Fill it out including the port number (default 8080)
- We also need to provide the "SABnzbd API Key". This is used to talk to the SABnzbd download engine. You can find your API key inside the web GUI from SABnzbd by navigating inside SABnzbd to "Config" and "General". In that section you can find the "API Key" which looks likes the following b354ee0224302021aba6cb15f21029a6. Just copy your API Key and paste it inside the box "SABnzbd API Key".
- Leave the "Category" default to [tv] (we are going to set that later inside SABnzbd)
- Test the connection to SABnzbd and if Sucess, hut the "Save Changes" button
Configuring directories for Sickbeard
- We need to set the TV Download Directory to match our "Series" sub-folder we have setup. If you navigate inside Sickbeard to "Config" and select "Post-Processing" you can change it
- We mapped /media to our storage array and have a sub-directory named "Series" that we are going to use. Our "TV Download Dir" should be /media/Series as you can see in the screen-shot below
- I also use the "Rename Episodes" to have everything organized neatly and use the "Scan and Process" for manual placement of files inside the "Series" share.
Creating categories in SABnzbd for Sickbeard
- The very last step before we can add our series is to create a category for Sickbeard that is linked to the "TV Download Dir".
- Navigate inside SABnzbd to "Config" and navigate to "Categories". We need to add a category called "tv" and set the folder/Path to the "Series" sub-folder. This way Sickbeard knows what downloads are his and can rename/move the series to the correct sub-folders. Below is the screen-shot of the settings where I point the category "tv" towards /media/Series
Thats it! If you navigate towards the Sickbeard GUI you should be able add series. It will be downloaded by SABnzbd and moved to the "Series" share where it will be processed by Sickbeard.