Build A Complete Linux Media Server – Install Nzbget

This entry is part 4 of 6 in the series Complete Linux Media Server

Install Nzbget Usenet Downloader

This article describes how to download and install nzbget on a debian server.

Usenet is a distributed system where users read and post messages – articles or posts, and collectively termed news) to one or more categories, known as newsgroups. They have been around since before the internet as we know it existed – think of it as a large, distributed forum. It was originally designed to transmit text messages but has since proved exceedingly popular for binaries i.e. programs and other files.

Nzbget is a downloader client for Usenet newsgroups binaries – it’s fast, efficient, has a small system footprint and of course it’s free! While transmission-daemon will take care of the torrent downloads, nzbget in turn takes care of newsgroup binary downloads.

A binary file in a newsgroup is split into a number of “part” files to allow posting – once all files have been downloaded, the original file can be reassembled – should one part file be missing or corrupted however then reassembly is not possible. Nzbget downloads all the part files and reassembles the file, notofying the user should anything be amiss.

The last thing to say is that while many internet providers have a limited Usenet service for their customers, to take real advantage of newsgroups you will need to take out a subscription – a quick google for providers will soon have you up and running and many have a free trial period.

Htpcguides have already written an excellent guide on installing nzbget on debian and ubuntu systems so this tutorial has been taken from their site and modified only to run as the user and group – nobody:nogroup – which we are configuring.

Install unrar

Unrar is the program that nzbget uses to unpack and reassemble the part files – you can install this with apt-get install unrar OR build it from source as described below to take advantage of multicore PCs which all of them are nowadays.

Why bother? Well, newsgroup binaries tend to be in a rar format so the faster we can decompress them the better – let’s use as many cores as possible!

We are going to build the latest unrar from source adapted from these instructions.

  1. Make sure you have building tools:
    • sudo apt-get install build-essential -y
  2. Enter your temporary directory
    • cd /tmp
  3. Download the latest unrar source tarball
    • wget rarlab.com/rar/unrarsrc-5.2.7.tar.gz
  4. Unpack the unrar source
    • tar -xvf unrarsrc-5.2.7.tar.gz
  5. Enter the unrar source
    • cd unrar
  6. Get the number of processors for compiling faster
    • nproc
  7. I have 2 so when building I add 2 after -j
    • make -j2 -f makefile
  8. Now install unrar
    • sudo install -v -m755 unrar /usr/bin
  9. Cleanup your unrar source and unpacked directory
    • cd ..
    • rm -rf unrar
    • rm unrarsrc.5.2.7.tar.gz

Install NZBGet

  1. Download the latest stable NZBGet installer – check the page and insert the correct link:
    • http://nzbget.net/download/
    • wget https://github.com/nzbget/nzbget/releases/download/v16.4/nzbget-16.4-bin-linux.run
  2. Install NZBGet on Debian 8.x:
    • sudo sh nzbget-16.4-bin-linux.run --destdir /opt/nzbget
  3. Remove the installer
    • rm nzbget-16.4-bin-linux.run
  4. Change ownership of the NZBGet installation to our nobody user
    • sudo chown -R nobody:nogroup /opt/nzbget
  5. Update your NZBGet configuration file to run as  nobody
    • sudo sed -i "/DaemonUsername=/c\DaemonUsername=nobody" /opt/nzbget/nzbget.conf
  6. Create the NZBGet systemd service
    • sudo nano /etc/systemd/system/nzbget.service
  7. Paste the working NZBGet systemd script for Debian
    • [Unit]
      Description=NZBGet Daemon
      Documentation=http://nzbget.net/Documentation
      After=network.target
      
      [Service]
      User=nobody
      Group=nogroup
      Type=forking
      ExecStart=/opt/nzbget/nzbget -c /opt/nzbget/nzbget.conf -D
      ExecStop=/opt/nzbget/nzbget -Q
      ExecReload=/opt/nzbget/nzbget -O
      KillMode=process
      Restart=on-failure
      
      [Install]
      WantedBy=multi-user.target
  8. Enable the NZBGet systemd service
    • sudo systemctl enable nzbget.service
  9. Start the NZBGet systemd service for Debian
    • sudo service nzbget start
    • Confirm you have access to NZBGet on http:/your_ip_here:6789, the default username is nzbget and password is tegbzn6789.nzbget web gui
  10. Change the default username and password under “SETTINGS: ControlUsername and Control Password” – we will need this later when we integrate nzbget into Sonarr:

    • change default username and password
  11. Lastly and definitely not least, enter your news server(s) address under SETTINGS -> NEWS-SERVERS. There are 4 parameters per server which must be configured:
    • Host – the address of your news server
    • Port – can be anything but generally 119 for non-SSL (unencrypted ) connections and 563 for SSL connections
    • Username and password for your Usenet providernews server configuration

Build A Complete Linux Media Server – Install Sonarr Series Download Manager

This entry is part 5 of 6 in the series Complete Linux Media Server

Install Sonarr Downloader

This article describes how to install Sonarr on Debian and integrate it with the previously configured transmission and nzbget programs.

Sonarr is the new name for NZBdrone – an application which not only automates TV show downloads but also maintains them after this is done. For example, depending on settings you configure, Sonarr will download an episode of a series in SD format as soon as it is posted and then upgrade it as progressively better quality releases become available.

Install Mono

Mono is an open source impementation of Microsoft’s .NET runtime and required in order run Sonarr. Debian needs a couple of extra steps to install this:

  1. Add the mono repositories to the Debian sources list:
    • sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
      echo "deb http://download.mono-project.com/repo/debian wheezy main" | sudo tee /etc/apt/sources.list.d/mono-xamarin.list
      echo "deb http://download.mono-project.com/repo/debian wheezy-libjpeg62-compat main" | sudo tee -a /etc/apt/sources.list.d/mono-xamarin.list
  2. Update the package lists and install:
    • sudo apt-get upgrade && sudo apt-get install mono-devel

 Install Sonarr

First, add the Sonarr software repository to the debian software source list. This will allow us to easily install (and upgrade in the future) using apt-get:

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys FDA5DFFC
echo "deb http://apt.sonarr.tv/ master main" | sudo tee /etc/apt/sources.list.d/sonarr.list

The next step is to install Sonarr itself:

sudo apt-get update
sudo apt-get install nzbdrone

Configure Sonarr to Run As a Service Under nobody:nogroup

  1. Change permissions on the Sonarr folder:
    • sudo chown -R nobody:nogroup /opt/NzbDrone/
  2. Create the file sonarr.service in /etc/systemd/system/ and paste in the following:
    • [Unit]
      Description=Sonarr Daemon
      After=network.target
      
      [Service]
      User=nobody
      Group=nogroup
      Restart=always
      RestartSec=5
      Type=simple
      ExecStart=/usr/bin/mono /opt/NzbDrone/NzbDrone.exe -nobrowser -data=ExecStart=/usr/bin/mono /opt/NzbDrone/NzbDrone.exe -nobrowser -data=/home/nobody/.config/NzbDrone
      TimeoutStopSec=20
      KillMode=process
      Restart=on-failure
      
      [Install]
      WantedBy=multi-user.target
  3. Update systemctl, enable the service and start sonarr:
    • sudo systemctl daemon-reload 
      sudo systemctl enable sonarr 
      sudo systemctl start sonarr
  4. This point is just a reminder that if you haven’t given nobody a home as detailed on the server install page then you’ll need to do it now and then restart sonarr. This is necessary to enable sonarr to auto-update which it can only do if the config files are kept separately away from its install directory.

Connect to Sonarr Web GUI

Open your browser and browse to http://your_server_ip:8989/

You should now see the following and this tells us that everything is working well:

sonarr web gui

Now we can proceed to our Sonarr configuration – click here to continue!