We recently showed you how to turn your Raspberry Pi into a 24/7 BitTorrent box to save on your power bill and keep your tracker ratios golden. Now we’re back to show you how to add in Usenet access to round out the build as a comprehensive downloading box.
Why Do I Want to Do This?
As we highlighted in How to Turn a Raspberry Pi into an Always-On BitTorrent Box, the primary reason for shifting your download activities to a Raspberry Pi unit is the enormous power savings. Compared to running a traditional computer as a home server/download box, running a Raspberry Pi in its place will save you a pile of cash.
If you followed along The How-To Geek Guide to Measuring Your Energy Use, you may recall that our modest office server burns through around $200 a year worth of electricity. By comparison the Raspberry Pi consumes about $3 per year. Even with external hard drives added into the system you would be hard pressed to break $10 a year in energy use.
While Usenet downloads are unidirectional (there’s no seeding, trackers, or ratio monitoring like there is with a peer-to-peer service like BitTorrent), you still benefit from 24/7 operation. If you use Usenet to grab your favorite TV shows, for example, an always on Raspberry Pi download box will snap them up the second they’re available.
The final benefit is how having an always-on download box shifts the burden off your desktop machine. You’ll never have to leave your desktop machine on over night to finish up that file or skip playing the game you wanted to play because your machine is tied up unpacking and verifying a huge download.
Read on as we show you how to turn your Pi into a lean, mean, and dead silent Usenet downloading machine.
What Do I Need?
For this tutorial we assume that you have a Raspberry Pi unit with Raspbian installed, are able to access the device either directly via an attached monitor and keyboard or remotely via SSH and VNC, and that you have a USB drive (or drives) attached to it. If you need to get up to speed in these areas, we strongly suggest reading the following guides in the order we have them listed here:
- The HTG Guide to Getting Started with Raspberry Pi
- How to Configure Your Raspberry Pi for Remote Shell, Desktop, and File Transfer
- How to Turn a Raspberry Pi into a Low-Power Network Storage Device
Everything in the first tutorial is necessary, the second tutorial is optional (but remote access is incredibly handy to have for this project as a download box is a perfect candidate for a headless build), and the most important part of the third tutorial is simply setting up the hard drive and configuring it to auto-mount on boot.
In addition to the prior reading list, if you’re not overly familiar with the ins and outs of Usenet, we strongly suggest reading the following tutorial:
TL;DR version: Use Newshosting, they are the best in the business.
If you’re already familiar with Usenet and have an account with a reliable Usenet provider, that’s awesome. If you don’t have a Usenet account you absolutely need to read our guide to get up to speed. Unlike torrents where you can get by hopping from public tracker to public tracker, there’s no such thing as a reliable and free public Usenet server. You’ll need to get an account from a reliable provider–see our guide for general information about Usenet and tips on which providers to consider.
Once you’ve reviewed all the material and have the Pi configured, it’s time to get down to the business of turning your Pi into a silent and ultra-low-power downloading beast.
Updating Apt-Get and Installing SABnzbd
The first order of business is to update and upgrade your apt-get installer. If you followed along with the recent guide, How to Turn a Raspberry Pi into an Always-On BitTorrent Box, you can skip this step as you just updated and upgraded during that tutorial.
At the terminal, enter the following commands:
sudo apt-get update
sudo apt-get upgrade
If you haven’t updated/upgraded in a while, be prepared to grab a cup of coffee while you wait for the process to finish.
Once updated, it’s time to install SABnzbd. Before we do so, a note on why we opted for SABnzbd is in order. If you’re looking to run an absolutely barebones setup that is light on system resources, it would make sense to use some of the command-line only tools like NZBGet. The tradeoff, however, is that you lose access to the huge amount of third-party apps, plug-ins, and integration that comes with a mature and well-developed tool like SABnzbd. We tested both on the platform and while there’s no debate that an ultra lightweight tool like NZBget consumes less system resources, we’re loath to give up the polished interface and goodies that come with SABnzbd.
To get started installing SABnzbd, open up the terminal and enter the following command:
sudo apt-get install sabnzbdplus
This will install the core dependencies for SABnzbd, including several Python tools (like the RSS Feed Parser and Cheetah template gallery) as well as the basic SABnzbd themes like Classic and Plush. During the rather lengthy package install process, you’ll see the following error at some point:
[....] SABnzbd+ binary newsgrabber: not configured, aborting. See /etc/default/s[warndplus ... (warning).
Don’t worry, this odd little error in the installation process just means that SABnzbd hasn’t been configured yet (which it wouldn’t be, naturally, as we’re installing it). Once the installation process has finished, move on to the next section.
Running the SABnzbd Configuration Wizard
After the sabnzbdplus installation has finished, you’ll be returned to the command prompt. Enter the following command to launch SABnzbd for the first time:
sabnzbdplus --server 0.0.0.0
The command starts the SABnzbd daemon and turns on the WebUI. Quite a bit of text will whirl by and then it will hang and give the illusion that the application has crashed. It hasn’t, it has just taken control of the terminal, and as it performs new functions they will appear here. Either open up a new terminal window or SSH connection; if you CTRL+C to break out and return to the command prompt you’ll cause the daemon to shut down.
From either a browser on the Raspberry Pi or a remote browser on your desktop, you can now start up the configuration wizard. We’d strongly advise you to use a remote web browser for ease of use and better performance.
In your web browser of choice, navigate to:
http://[Your Pi's IP]:8080/wizard/
Select your preferred language and click Start Wizard. The first step is to input your Usenet provider’s information — we recommend Newshosting, but you can use whatever provider you’d like.
Input the host, port, username/password, and set the number of connections. While you can easily get away with 20+ connections on a desktop or server installation, we suggest starting with 5 connections on your Pi and creeping the number upwards if you find you need more concurrent connections. Click Test Server to see if your login/username checks out with your provider.
Step two of the wizard sets the access control:
It’s important that you select “I want my SABnzbd to be viewable by any pc on my network” and that you uncheck “Launch my internet browser with the SABnzbd page when the program starts”. Once we’re done configuring SABnzbd, this is going to be a headless box and there’s no reason to launch the default browser on the Pi and chew up system resources. Setting a username/password is optional.
You can skip step three of the quick-start wizard altogether, as both of the supplemental services they suggest you plug in your user data for are now defunct. Click next to skip ahead to step four. Step four is automated, the SABnzbd daemon will restart and the wizard will show you the web addresses you can access the WebUI like so:
Go ahead and click “Go to SABnzbd” to exit the wizard and get dumped into the main SABnzbd user interface.
Installing UNRAR for Automated Unpacking
As you’re scanning over the new interface, you might notice that right out of the gate there’s a warning: “No UNRAR program found, unpacking RAR files is not possible”.
SABnzbd’s core installation package doesn’t install a RAR program, and that’s problematic. We’ll be able to download files from Usenet, but they won’t automatically unpack. You know what doesn’t sound like fun? Having to manually unpack all our downloads.
In order to automate the file unpacking, we’re going to have to build a copy of the free but unintuitively named unrar-nonfree app. Fortunately, a helpful soul at the RaspberryPi.StackExchange outlined just how to do so for Raspian.
At the terminal, enter the following command to allow you edit your sources.list and add the repository that contains unrar-nonfree:
sudo nano /etc/apt/sources.list
In nano, add the following line to the .list file:
deb-src http://archive.raspbian.org/raspbian wheezy main contrib non-free rpi
Press CTRL+X to exit nano and Y to save/overwrite the old .list file. Back at the command prompt, you will need to update your sources list for the change to take effect:
sudo apt-get update
After the update is finished (it should be pretty snappy if you updated earlier in the tutorial), it’s time to create a working directory and then move to it:
mkdir ~/unrar-nonfree && cd ~/unrar-nonfree
Time to download unrar-nonfree’s dependencies:
sudo apt-get build-dep unrar-nonfree
When the process finishes and you’re back at the prompt, enter the following command to download the source code and build the installation package:
sudo apt-get source -b unrar-nonfree
Now it’s time to install the package. If you’re following this tutorial after a new version of unrar-nonfree is released, you’ll need to update the filename. You can check the version number by typing “ls” at the command prompt to list the files we downloaded in the previous steps:
sudo dpkg -i unrar_4.1.4-1_armhf.deb
Once the installation is complete, you can quickly test to see if command “unrar” is available to the system by simply typing “unrar” at the command prompt. If properly installed, the unrar app will shoot back a list of all the available switches and their descriptions. If the package installed without error, you can tidy up after yourself with the following command:
cd && rm -r ~/unrar-nonfree
Now it’s time to clear out the error in SABnzbd. Restart SABnzbd from within the WebUI by clicking on Options -> Restart. When you restart the error message should be gone from the upper left hand region of the WebUI. You can double check that the error log is empty by clicking on the Status link in the upper left hand corner:
All clear! We’ve installed unrar-nonfree so it can automatically unpack our downloads, but right now the default download directories are pointing at the tiny SD card on the Raspberry Pi. Let’s point them at our external HDD.
Configuring the SABnzbd Directories
By default, any files you download are going to get dumped into the /home/pi/downloads directory. A half hour on even a modest broadband connection will completely fill up the SD card, at which point your adventures in Usenet download will come to an end when SABnzbd automatically pauses your downloads and grinds the whole operation to a halt.
To avoid that, we’re going to move all the important directories off the SD card and on to the external hard drive. If you do not already have a USB hard drive attached to your Raspberry Pi and set to auto-mount at boot, we would advise checking out our tutorial How to Turn a Raspberry Pi into a Low-Power Network Storage Device to see how to do so. We’re going to use the same HDD naming convention and directory structure we used in that tutorial, so adapt your commands in this section to match the location of your HDD.
First, let’s create the directories we need for SABnzbd:
sudo mkdir /media/USBHDD1/shares/SABnzbd/downloading
sudo mkdir /media/USBHDD1/shares/SABnzbd/completed
sudo mkdir /media/USBHDD1/shares/SABnzbd/watch
sudo mkdir /media/USBHDD1/shares/SABnzbd/watch/nzb-backup
sudo mkdir /media/USBHDD1/shares/SABnzbd/scripts
After creating the directories, return to the WebUI of SABnzbd to change the default directories. In the WebUI, navigate to Config -> Folders. There are two sections, User Folders and System folders. Within those two sections, change the following entries using the folders we just created. You must use absolute paths to force SABnzbd to use folders outside the default of /home/pi/.
Temporary Download Folder:
Completed Download Folder:
.nzb Backup Folder:
In addition to these changes, you can set the “Minimum Free Space for Temporary Download Folder” by using designations such as 900M for 900 megabytes or 20G for 20 gigabytes. We generally leave 10-20GB free on our disk to serve as a nice buffer.
Once you have made all your changes, click Save at the bottom of the menu. The changes we made require a restart, so click Downloads to return to the main WebUI and then click Options -> Restart in the upper right hand corner.
Testing Your SABnzbd Installation
After SABnzbd restarts, it’s time to take it for a spin. For our test we headed over to Binsearch.info and found a copy of Linux Mint to download. To start the download, we dumped the .NZB file into the SABnzbd /watch/ folder where SABnzbd snatches it up. It will appear in the Queue and then transfer to the History section of the WebUI as it shifts from downloading to verifying and unpacking, as seen in the screenshot above.
For those of you who are curious how SABnzbd on the Pi stacks up against SABnzbd on a regular computer, we ran several tests wherein we downloaded the exactly same file on both our server and on the Raspberry Pi and compared the results.
The Pi performed better than we anticipated, routinely coming in at only around 15% slower than a full desktop machine. In real world terms, that meant that a 1GB download took around 14 minutes to download, verify, and unpack on the desktop machine, compared to around 16 minutes on the Raspberry Pi. Not bad!
Setting SABnzbd to Start on Boot
Compared to some of our other recent projects, setting up on-boot startup for SABnzbd plus is a cinch. The installation package already created a /init.d/ script for you. The only thing you have to do is edit the SABnzbd /etc/default/ file to indicate which user you want the daemon to run under.
In order to do so, type the following command in the terminal to open up nano and the SABnzbd configuration file:
sudo nano /etc/default/sabnzbdplus
The only variable you need to edit is USER=; insert the username of the account you wish to run the daemon under. We used the default user account (and the one we installed SABnzbd under) “pi”. Press CTRL+X to exit and save your edit. You can test whether or not the changes took effect by either reboot your Pi unit or simply checking to see if you can start SABnzbd as a service with the following command:
sudo service sabnzbdplus start
If the changes were effective, the above command should return the following sequence:
[....] Starting SABnzbd+ binary newsgrabber:
[ ok ] Starting SABnzbd+ binary newsgrabber:.
Note: if you run the service start command while SABnzbd is running, you’ll get the above sequence but it will say “fail” instead of “ok”; that means it still tried to run the daemon but failed because it was already started.
Speed Boosting Configuration Enhancements
While we noted in the SABnzbd test section that we found the Pi performed on par with a desktop machine, there are a few tweaks you can make to the configuration file that will significantly improve your performance if you’re looking to squeeze out more speed. Navigate to the main WebUI and click on Config. We’ll go through each relevant section and the tweaks inside one by one. The configuration tweaks are ordered by greatest return to least return for your effort:
In the Config -> Servers section:
Disable SSL. Unless you’re ultra paranoid about your ISP monitoring you, switch from your providers’ SSL server to their regular server. In our tests we found that the overhead of SSL encryption lowered our download speeds roughly 50% and slowed down the unpacking process during downloads, as SSL took up so much of the Pi’s processing power.
In the Config -> Switches section:
Turn on Detect Duplicate Downloads. You don’t want to waste the time, bandwidth, and processing power to download a file that you’ve previously downloaded. The options here are Discard and Pause. It’s handy to use Pause so that you can periodically review the queue and decide if you really do want to redownload the file.
Turn on Pause Downloading During Post-Processing: While the Pi really hums along when it is downloading and unpacking a single item, when it’s tearing through a big backlog, tandem downloading and post-processing can really put a strain on it. Enabling this option tells the Pi to pause your downloads while processing the recently finished ones.
In the Config -> General section:
Set Article Cache Limit: While we’ve left this option unmanaged, many users on the SABnzbd forum report positive results on the Pi by setting this option to 32M or 64M.
Installing the Mobile Interface and Mobile Apps
If you want to easily control your SABnzbd installation from a mobile device, you will either need to install one of the mobile WebUI templates or download one of the available control apps from the App Store or the Google Play.
When we installed the main package at the beginning of the tutorial, we received the Classic and the Plush themes. Let’s take a moment to install a mobile theme. If you want the general mobile theme, seen in the screenshot above, enter the following command at the terminal:
sudo apt-get install sabnzbdplus-theme-mobile
If you would like the iOS-like iPhone theme, entre the following command instead:
sudo apt-get install sabnzbdplus-theme-iphone
Once you’ve installed one of the mobile themes, head over to the WebUI and navigate to Config -> General -> SABnzbd Web Server. Under the sub-section Secondary Web Interface, you will be able to select the mobile skin you installed, like so:
Scroll down and save your changes, and then click Restart SABnzbd (right next to the save button). Once the restart is complete, you’ll be able to access the secondary/mobile interface at the following URL:
http://[Your Pi's IP]:8080/m/
If you want to further enhance your Usenet experience, mobile apps go beyond the basics of the simple mobile interface. Apple fans with an iPhone or iPad will definitely want to check out the following apps:
Android users also have a nice spread to choose from, including:
Many of the mobile apps offer enhanced features such as RSS-to-NZB transfers, advanced queue management, and more.
At this point, you’ve installed SABnzbd, wrangled with its dependencies, optimized it, grabbed a mobile skin/control app, and you’re ready to saturate your pipeline with sweet, sweet, Usenet goodness. Keep a close eye on the front page here as we continue to bring you detailed guides to getting even more out of your Raspberry Pi.