NZBGet

From Alpine Linux
Revision as of 08:24, 4 July 2023 by Jdusablon (talk | contribs) (formatting)

Introduction

  • This guide explains how to install the popular service nzbget on Alpine Linux. Specifically, the environment used is 3.18 running in an LXC container. This guide should still work in a standard Alpine Linux install.
  • This guide sets up nzbget as a standard rc init service.
  • The path /opt is used in this guide, however the choice of path is immaterial to the outcome, for example, /srv should work fine.
  • This guide assumes all commands are run as root unless specified.

Download and install nzbget

Fetch and install the latest nzbget install script. (If you have security concerns, nzbget code is available to inspect at github).

wget https://nzbget.net/download/nzbget-latest-bin-linux.run

Run the install script.

chmod +x nzbget-latest-bin-linux.run
./nzbget-latest-bin-linux.run

Move the nzbget directory to /opt}

mv nzbget /opt/

Create nzbget service

Create the nzbget init file:

vi /etc/init.d/nzbget

With the following content:

#!/sbin/openrc-run
 
depend() {
	need net
}
 
start() {
	/opt/nzbget/nzbget -D
}
 
stop() {
	/opt/nzbget/nzbget -Q
}

Notice that the commands /opt/nzbget/nzbget -D and /opt/nzbget/nzbget -Q are used to cleanly start and stop the service.

Add the service to rc init:

rc-update add nzbget

Start the service:

rc-service nzb start

Notes

  • At this point, you should be able to reach nzbget at http://<YOURIP>:6789. You should be able to start and stop the nzbget service and the service should start after a system restart/reboot:

rc-service nzb start
rc-service nzb stop

  • Any further configs can be set using the webgui or in /opt/nzbget/nzbget.conf.
  • Of note is the line in /opt/nzbget/nzbget.conf:

DaemonUsername=root

This allows the service to start and run as a specific user, which is a common setup if nzbget is used in conjunction with other media managers and shared storage. Note that any working directories specified in the settings will require their permissions updated to work correctly.

  • nzbget is quite descriptive in its logs. Check nzbget's Messages section for errors, including permissions and paths.

Updating nzbget

As of version 21.2, the certificate that ships with nzbget for updating from nzbget.net is expired and updates will consequently fail until it is updated. Fortunately, this can be rectified:

Stop the nzbget service:

rc-service nzbget stop

If you run the nzbget service under any other user than root, change this back to root temporarily for the update in /opt/nzbget/nzbget.conf:

DaemonUsername=root

Fetch the new and valid certificate:

curl --remote-name --time-cond cacert.pem https://nzbget.net/info/cacert.pem

Move the new certificate to the correct path:

mv cacert.pem /opt/nzbget/cacert.pem

Start the nzbget service:

rc-service nzbget start

Navigate to your instance of nzbget, Settings, System, Update NZBGet:

nzbget update screenshot











If required, stop the nzbget service again and revert the DaemonUsername to its normal value in /opt/nzbget/nzbget.conf:

rc-service nzbget stop
DaemonUsername=root

and start the service again:

rc-service nzbget start