Quick Links

We recently showed you how to turn your Raspberry Pi into an always on Usenet machine centered around the feature-rich SABnzbd Usenet client. Now we're back to show you how to use NZBGet, a more Spartan but also very lightweight Usenet tool.

Why Do I Want To Do This?

If you followed along with our How to Turn a Raspberry Pi into an Always-On Usenet Machine and you're perfectly happy with the results, then you can skip this tutorial altogether.

If, on the other hand, you've found that resource-intensive SABnzbd is taxing your Raspberry Pi too much (especially if you're running it side-by-side with a BitTorrent client), then switching to NZBGet is a great way to free up system resources. You'll lose a variety of features in the process, but the core functionality (importing NZB files, downloading content, unpacking it, and interacting with helper apps like SickBeard and CouchPotato) is all still available with NZBGet.

Be forewarned, however, that installing NZBget is a significantly bigger hassle (and involves compiling both NZBget and patched helper apps).

What Do I Need?

For this tutorial, we assume that you have a functional Raspberry Pi with Raspbian installed and have followed along with our previous tutorials. I have you have and you're just here to swap out SABnzbd for NZBget, jump to the next section. If you're brand new to the process and want to get on board, we suggest starting with the following articles in the order we have them listed here:

  1. The HTG Guide to Getting Started with Raspberry Pi
  2. How to Configure Your Raspberry Pi for Remote Shell, Desktop, and File Transfer
  3. 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 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:

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.

Updating Apt-Get and Installing UNRAR

Note: If you recently followed along with the SABnzbd guide, you can safely skip this entire section as you've already updated your apt-get tool and installed UNRAR.

The first order of business is to update and upgrade your apt-get installer. If you followed along with one of our other Raspberry Pi guides and updated everything, you can skip this step.

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 wait out a lengthy upgrade process.

Just like with the SABnzbd installation tutorial, we'll need to install a supplemental tool to handle file archives.

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 Raspbian.

At the terminal, enter the following command to allow you to 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 that we have our UNRAR app installed, it's time to get down to the business of installing and configuring NZBGet.

Installing and Configuring NZBget

2013-04-28_164915

Unlike the SABnzbd installation process, this one is significantly longer/more fiddly, so be ready to spend a bit of time at the prompt. In addition to spending a bit more time at the prompt, be prepared for some downtime when using the "make" command to compile apps.

The first order of business is to make a temporary directory, like we did with our UNRAR installation, in which to work. Just like with UNRAR, we're going to have to get our hands dirty building an installer. At the prompt, enter the following commands:

        sudo mkdir /temp-nzbget
cd /temp-nzbget

Now we need to download and extract NZBget. As of this writing, the stable release is version 10.2. Check the NZBget web site to make sure you're downloading the most current stable version.

        sudo wget http://sourceforge.net/projects/nzbget/files/nzbget-10.2.tar.gz
sudo tar -xvf nzbget-10.2.tar.gz
cd nzbget-10.2

Since NZBGet doesn't have a nice prepackaged installer for us, we're going to need to manually install all the dependencies. If you're curious what each dependency is for, check out the prerequisites list here. At the prompt, enter the following commands:

        sudo apt-get install libncurses5-dev
sudo apt-get install sigc++
sudo apt-get install libpar2-0-dev
sudo apt-get install libssl-dev
sudo apt-get install libgnutls-dev
sudo apt-get install libxml2-dev

After you've installed all the dependencies, we need to perform a small patch operation on libpar2. You can technically skip this patch but the patch allows you to set a time limit on the par-repair process. This is used for slower devices like our little Raspberry Pi download box.

Note: if you don't patch the files, you'll get an error during the configuration process unless you append the ./configure command with --disable-libpar2-bugfixes-check

To patch libar2 enter the following commands at the prompt:

        sudo wget http://sourceforge.net/projects/parchive/files/libpar2/0.2/libpar2-0.2.tar.gz
sudo tar -xvf libpar2-0.2.tar.gz
cd libpar2-0.2
cp /temp-nzbget/nzbget-10.2/libpar2-0.2-*.patch .
sudo patch < libpar2-0.2-bugfixes.patch
sudo patch < libpar2-0.2-cancel.patch
./configure
sudo make
sudo make install

Now it's time to compile and install NZBget:

        cd /temp-nzbget/nzbget-10.2
./configure
sudo make
sudo make install

Once that process is complete, we have one more task before we configure NZBget. We need to create a set of directories for NZBget to use. We're assuming you're using the same directory structure we've been using throughout our Raspberry Pi tutorials. If not, you need to modify your directories accordingly.

At the command prompt, enter the following commands to create your NZBget directories:

        sudo mkdir /media/USBHDD1/shares/NZBget
sudo mkdir /media/USBHDD1/shares/NZBget/dst
sudo mkdir /media/USBHDD1/shares/NZBget/nzb
sudo mkdir /media/USBHDD1/shares/NZBget/queue
sudo mkdir /media/USBHDD1/shares/NZBget/tmp
sudo mkdir /media/USBHDD1/shares/NZBget/post-proc

You can change the naming structure, but then you also have to go through the configuration files and change all the default folder names (which isn't really worth the hassle).

Once you've created the folders, it's time to edit the NZBget configuration file. At the prompt, enter the following command:

        sudo cp /usr/local/share/nzbget/nzbget.conf /etc/nzbget.conf
sudo nano /etc/nzbget.conf

The configuration file is heavily annotated with helpful comments (but we're not going to include all the comment lines in our instructions here because it would make the blocks of text unnecessarily long); read down through the file carefully to edit the following portion of the configuration file in the ### PATHS section:

        MainDir=/media/USBHDD1/shares/NZBget
    

In the ### NEWS-SERVERS section enter your Usenet Server login credentials:

        Server1.Host=yourserver.com
Server1.Port=119
Server1.Username=username
Server1.Password=password
Server1.JoinGroup=yes
Server1.Encryption=no
Server1.Connections=5

Once you finish editing the file, hit CTRL+X and save. Before we launch NZBget, we have one small batch of files to copy. Back at the command prompt, enter the following command:

cp /temp-nzbget/nzbget-10.2/nzbget-postprocess* /media/USBHDD1/shares/NZBget/post-proc

This copies all the post processing scripts from our temporary installation folder to the permanent post processing folder. Now we can launch NZBget daemon and make sure everything is working OK. Enter the following command:

        sudo nzbget -D
    

You can now navigate to the IP address of your Raspberry Pi with the following port number:

        http://[Your Pi's IP]:6789
    

to check out the WebUI for NZBget. The default username is "nzbget" and the default password is "tegbzn6789".

We won't be spending much time here, just long enough to poke around and make sure everything is running properly. (Once we've finished with the NZBget configuration and start-at-boot process, you won't look at NZBget much anymore as it will be called by all your helper applications such as SickBeard and CouchPotato).

While we're here, take a moment to add an NZB file--if you're for want of an NZB file, head over to binsearch.info and look for your favorite Linux distribution.

Once you've confirmed that you can start up NZBget and download a file, it's time to configure NZBget to start at boot. If you've been following along with all of our Raspberry Pi tutorials (or are a Linux veteran), this whole process will seem quite familiar.

Enter the following command at the command prompt:

        sudo nano /etc/init.d/nzbget
    

Within the file, paste the following code:

        #!/bin/sh
### BEGIN INIT INFO
# Provides:          NZBget
# Required-Start:    $network $remote_fs $syslog
# Required-Stop:     $network $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start NZBget at boot
# Description:       Start NZBget
### END INIT INFO
case "$1" in
start)   echo -n "Start services: NZBget"
/usr/local/bin/nzbget -D
;;
stop)   echo -n "Stop services: NZBget"
/usr/local/bin/nzbget -Q
;;
restart)
$0 stop
$0 start
;;
*)   echo "Usage: $0 start|stop|restart"
exit 1
;;
esac
exit 0

Press CTRL+X, save your work, and exit nano. Now we need to change the permissions on the file and update the rc.d. Enter the following commands at the prompt:

sudo chmod 755 /etc/init.d/nzbget

sudo update-rc.d nzbget defaults

Reboot your system and confirm that NZBget starts automatically.


At this point, you're ready to go with a simple NZBget installation. The next step is to head over to our automation guide, How to Automate Your Always-On Raspberry Pi Download Box, and follow along with the installation instructions. Every tool we use in the guide with SABnzbd is also compatible with NZBget, so just make the appropriate substitutions in the settings menus.