Install NZBGet 14 Raspberry Pi with Raspbian

raspberry_pi_nzbgetNZBGet is a lightweight usenet downloader recently updated to 14.0 so NZBGet and the Raspberry Pi fit well together. NZBGet 14 supports fake detector for discarding fake releases on usenet. This will be in my upcoming Ultimate Raspberry Pi Usenet Guide. I recommend a UsenetServer account for downloading from usenet. I tested this several times on a fresh Raspbian image from September 2014. Let's install NZBGet 14 Raspberry Pi for lightweight usenet downloading.

Edit: There is now an easier way to install the latest NZBGet automatically without building from source

If you are trying to figure out which hardware would work best for you, consider reading the Pi benchmarks.

Pi Unit
Processor
RAM
RAM Bus
Network
WiFi
USB
SATA
Cost
Raspberry Pi 3
1.2 GHz ARMv8
Quad Core
1 GB DDR2
450 MHz
100 Mbit
Yes
4
No
$35
Raspberry Pi 2
900 MHz ARMv7
Quad Core
1 GB DDR2
450 MHz
100 Mbit
No
4
No
$35.00
Raspberry Pi
700 MHz ARMv6
Single Core
512 MB SDRAM
400 MHz
100 Mbit
No
4
No
$25
Banana Pi
1 GHz ARMv7
Dual Core
1 GB DDR3
432 MHz
Gigabit
No
2
Yes
$36.99
Banana Pi Pro
1 GHz ARMv7
Dual Core
1 GB DDR3
432 MHz
Gigabit
Yes
2
Yes
$45.00

Install NZBGet 14 Raspberry Pi with Raspbian

Update and upgrade

sudo apt-get update
sudo apt-get upgrade -y

Install the Correct Unrar version
This fixes Error Unrar 10

You can install this unrar package that is precompiled for the Raspberry Pi

wget http://sourceforge.net/projects/bananapi/files/unrar_5.2.6-1.arm6_armhf.deb

Install the unrar package

sudo dpkg -i unrar_5.2.6-1.arm6_armhf.deb

If the precompiled package doesn't work you can build from source

sudo apt-get install build-essential -y
wget rarlab.com/rar/unrarsrc-5.2.6.tar.gz
tar -xvf unrarsrc-5.2.6.tar.gz
cd unrar
sudo make -f makefile
sudo install -v -m755 unrar /usr/bin

It also solves Unrar error 64 as long as you are using absolute paths in NZBGet

Install NZBGet from Mike's repo

Add these magic keys to authenticate with his repo

gpg --recv-keys --keyserver keyserver.ubuntu.com 0E50BF67
gpg -a --export 0E50BF67 | sudo apt-key add -

Add Mike's repo with this command

echo "deb http://packages.unusedbytes.ca wheezy main" | sudo tee -a /etc/apt/sources.list

Update your sources

sudo apt-get update

Install NZBGet

sudo apt-get install nzbget -y

Copy the default NZBGet configuration file

sudo cp /usr/share/nzbget/nzbget.conf ~/.nzbget

Change ownership of the configuration file to avoid permission issues

sudo chown pi:root ~/.nzbget

Run NZBGet to make sure it works

nzbget -D

Try browsing to the IP address of your Pi at http://ip.address:6789 the default username is nzbget and default password is tegbzn6789
If you have issues with the above process you will have to build NZBGet from source.

If you didn't have issues scroll down to make NZBGet autostart on boot.

Build NZBGet from Source

Install dependencies and screen for compiling in the background

sudo apt-get install build-essential libsigc++-dev sigc++ libncurses5-dev libssl-dev libxml2-dev unzip p7zip-full ncurses-dev openssl screen -y

Download the NZBGet 14 source

wget http://sourceforge.net/projects/nzbget/files/nzbget-14.2.tar.gz

Unpack the source and enter the folder it creates

tar -xvf nzbget-14.2.tar.gz && cd nzbget-14.2

We are going to run screen so that it compile in the background

sudo apt-get install screen -y

Open a new screen session, press space twice to get through the messages

screen

Compile, install and create the configuration file for NZBGet 14.x. This also takes a good 20 minutes.

./configure --with-tlslib=OpenSSL && make && sudo make install && sudo make install-conf

You can now detach from the screen with Ctrl+A, then D (for detach) and close your Putty SSH session, it will still build.

Check on the NZBGet build process with

screen -r

When the build is done you should change the permissions of the configuration file

sudo chown pi:root /usr/local/etc/nzbget.conf

Install VideoSort

Install the Videosort post processing script to have NZBGet sort your video media automatically, if you are using CouchPotato you don't necessarily need this but it is useful if you are sending movie nzbs straight from your indexer to NZBGet.

Create an NZBGet scripts folder

mkdir -p /path/to/scripts && cd /path/to/scripts

Download VideoSort 5.0

wget http://sourceforge.net/projects/nzbget/files/ppscripts/videosort/videosort-ppscript-5.0.zip

Unpack the VideoSort Script

unzip videosort-ppscript-5.0.zip

Note: Your extension scripts folder is /path/to/scripts/ which you set in NZBGet Settings -> Paths -> ScriptDir
Note: For the Raspberry Pi the extra / is necessary after scripts (this may no longer be true)

Run the nzbget daemon

nzbget -D

Now try and access NZBGet at http://ip.address:6789 username:nzbget password:tegbzn6789

Autostart NZBGet on Boot

You can use an init.d script or upstart script. The upstart script is more reliable but can cause other issues.
For either of these methods your path may be /usr/bin/local if you built from source so adjust as necessary.

NZBGet init.d Script

Edit your NZBGet configuration

sudo nano /home/pi/.nzbget

Use Ctrl+W to find DaemonUsername=root and change it to

DaemonUsername=pi

Ctrl+X, Y and Enter to save

Create the init.d script

sudo nano /etc/init.d/nzbget

Paste this NZBGet init.d script

#!/bin/sh
### BEGIN INIT INFO
# Provides:          nzbget
# Required-Start:    $local_fs $network $remote_fs
# Required-Stop:     $local_fs $network $remote_fs
# Should-Start:      $NetworkManager
# Should-Stop:       $NetworkManager
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: starts instance of NZBGet
# Description:       starts instance of NZBGet using start-stop-daemon
### END INIT INFO
NZBGETPATH=$(which nzbget)
# Source init functions
. /lib/lsb/init-functions
# Start/stop the NZBget daemon.
#
case "$1" in
start)   echo -n "Start services: NZBget"
$NZBGETPATH -D
;;
stop)   echo -n "Stop services: NZBget"
$NZBGETPATH -Q
;;
restart)
$0 stop
$0 start
;;
*)   echo "Usage: $0 start|stop|restart"
exit 1
;;
esac
exit 0

Ctrl+X, Y and Enter to save

Make the NZBGet init.d script executable

sudo chmod +x /etc/init.d/nzbget

Update the system to start NZBGet on boot

sudo update-rc.d nzbget defaults

Reboot to test, if it will only work once the system has been up you can use a cronjob in conjunction with the init.d script.

This command adds a cronjob to start nzbget every time it boots if the init.d script isn't doing the job

crontab -l | { cat; echo "@reboot nzbget -D"; } | crontab -

Scroll to the bottom for further configuration and tweaks.

NZBGet Upstart Method

Install upstart if you understand the risks!

sudo apt-get install upstart

Enter Yes, do as I say!
Create the NZBGet upstart file

sudo nano /etc/init/nzbget.conf

Paste this code and save the file with Ctrl+X, Press y and then Enter

Note: if you are on Raspbmc remove the setuid and setgid lines (thanks to Raijmond)

#description "NZBGet upstart script"
#author "Ben Vassie"
 
setuid pi
setgid pi
 
start on runlevel [2345]
stop on runlevel [016]
 
respawn
 
script
exec nzbget -D
end script
 
pre-stop script
exec nzbget -Q
end script

See if the nzbget service works

sudo service nzbget start

It should say something like
nzbget start/running, process 4422
Reboot to make sure NZBGet starts on boot

sudo reboot

If you plan to use SSL with NZBGet use this cipher RC4-MD5 recommended by hugbug the developer of this fine software.

Since the Raspberry Pi is not the strongest machine, I recommend these NZBGet performance tweaks.

Now you are ready to configure NZBGet