I did this a long time ago, and for reasons that doesn't matter right now, I need to do it again on November 2022. And I realized that I forgot some important steps (some "tricks" actually) which made me spent some precious time.
So, for my own reference, but mainly and most important: for the reference of all the futures generations that you walk on the surface of this planet, here is the straight forward steps in order to have NZBGet installed correctly in a FreeBSD or TrueNAS Jail (which is my case, by the way).
In order to narrow things a bit, I will use some conventions here, but feel free to change them if know what you're doing.
All commands will be run as root.
By the way, I'll not explain here the process for create a jail in FreeBSD or TrueNAS. I'm assuming that you already has a jail, know how to build one or at least know how to search for how to know how to build one. Do your homework, kiddo.
If you search for nzbget in FreeBSD, you'll eventually find a package, ready to be installed:
pkg search nzbget
nzbget-21.1_2 Binary newsreader supporting NZB files
but... don't do that.
This package seems somewhat "incomplete" and will install files in such a way that will turn things difficult to work. I really don't know the reasons, and I confess that I didn't try to understood them too much, because I was hoping for a seamless and smooth installation/configuration, exactly how I got from sonarr/radarr/lidarr/bazarr. Anyway...
In order to install NZBGet on FreeBSD, do this instead:
First, go to this page, and download the installer:
cd /root
wget https://nzbget.net/download/nzbget-latest-bin-freebsd.run
NOTE: If you don't have wget and don't want to install it, you can use the native fetch, with the same results:
cd /root
fetch https://nzbget.net/download/nzbget-latest-bin-freebsd.run
Then turn on the executable bit:
chmod +x nzbget-latest-bin-freebsd.run
In order to follow the FreeBSD conventions, go to /usr/local/share and run the installer from there:
cd /usr/local/share
/root/nzbget-latest-bin-freebsd.run
The installer will create a folder nzbget at /usr/local/share. This folder will contain the NZBGet files.
The installer brings its own version of unrar, which doesn't work (segmentation fault). I guess it was compiled in another release of FreeBSD. In order to fix this, install unrar yourself:
pkg install unrar
unrar will be installed at /usr/local/bin. Now you have the option to keep things as they are and point NZBGet to find unrar at /usr/local/bin, or you can copy the working unrar to the installation folder. Both will work and this will be addressed later.
Beyond the /usr/local/share/nzbget, NZBGet will need at least 2 more folders: one for the configuration file, and another for downloading files.
Create them:
mkdir /usr/local/nzbget
mkdir /media/downloads
The first one follows the FreeBSD convention, and the second is free. If you decide to change it, remember to reflect your decision in the configuration file.
COPY the sample config file from the installer folder to the destination config folder:
cp -av /usr/local/share/nzbget/nzbget.conf /usr/local/nzbget/
Note: DO NOT remove the nzbget.conf from /usr/local/share/nzbget; the system needs it right there, as a kind of "template" for the web interface. You have been warned!!!
Now you need to creat a user to run NZBGet.
As my system runs in a jail, and several of them needs to "talk" to each other, I prefer to run all my related systems under only one and just one user, in order to avoid the famous "Permission War From HELL" effect. In my specific case this user is always plex (you've got the idea...). So...
Create a user and give it the permissions in all relevant folders:
pw add user plex -d /usr/local/share/nzbget
chown -R plex:plex /usr/local/nzbget
chown plex:plex /media/downloads
To be able to control NZBGet with service and also to start it at system/jail boot, create a script in /usr/local/etc/rc.d/nzbget with the following contents:
#!/bin/sh
# PROVIDE: nzbget
# REQUIRE: LOGIN
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf to enable the nzbget daemon:
#
# nzbget_enable="YES"
#
# Following additional settings are available:
#
# nzbget_user: user to run nzbget as (recommended)
# nzbget_conf: path to config if in a non-standard location (optional)
command=/usr/local/bin/nzbget
. /etc/rc.subr
load_rc_config nzbget
nzbget_enable=${nzbget_enable:-NO}
nzbget_user=${nzbget_user:-root}
nzbget_conf=${nzbget_conf:+"-c $nzbget_conf"}
name=nzbget
rcvar=nzbget_enable
start_cmd="nzbget_cmd -D"
stop_cmd="nzbget_cmd -Q"
reload_cmd="nzbget_cmd -O"
nzbget_cmd() {
/usr/bin/su $nzbget_user -c "exec $command $nzbget_conf $1"
}
run_rc_command "$1"
and set the permissions:
chmod +x /usr/local/etc/rc.d/nzbget
Now configure NZBGet to start at boot with the correct user and using the config file:
sysrc nzbget_enable=YES
sysrc nzbget_user=plex
sysrc nzbget_conf="/usr/local/nzbget/nzbget.conf"
From now on you will be able to control the NZBGet system with:
service nzbget start | stop | status
After starting the application with service nzbget start
, if everything is fine, you'll be able to access the WEB UI at:
- http://<IP_ADDR>:6789
From all the configurations, these ones are mandatory to get NZBGet working properly:
By default, NZBGet points the download folder to the home folder of the user under which it's running, and that's not always the case. In FreeBSD at least it's very common users which doesn't have a home folder. That's the case of our plex user, by the way. So the first thing is to change this and point to the download folder defined in 3.3 at the "PATHS" section:
And lastly, configure the path to unrar and 7-Zip accordingly:
If you want to avoid the ":6789" in your URL, you can put NZBGet behind a revere proxy.
Here is my configuration for Nginx:
server {
listen 80;
server_name nzbget.lan;
location / {
proxy_pass http://IP_ADDR:6789;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
which allows me to access NZBGet as "http://nzbget.lan".
NOTE: change "IP_ADDR" with the actual IP of your installation
I hope this guide will be helpful to you.
I'm open to all contributions and criticisms that you may have, including grammar and spelling mistakes.
Happy NZBGetting!
Hi, I get to step 3.7 and when I run service nzbget start I get the message 'su: no directory'. Any ideas on what could be causing this? My start script is /usr/local/etc/rc.d/nzbget. Is that correct?