NZBGet: Difference between revisions

From Alpine Linux
(formatting and template use)
m (Fixes some minor issue)
Line 43: Line 43:


Notice that the commands <code>/opt/nzbget/nzbget -D</code> and <code>/opt/nzbget/nzbget -Q</code> are used to cleanly start and stop the service.
Notice that the commands <code>/opt/nzbget/nzbget -D</code> and <code>/opt/nzbget/nzbget -Q</code> are used to cleanly start and stop the service.
Make the service file executable:
{{Cmd|# chmod +x /etc/init.d/nzbget}}


Add the service to rc init:
Add the service to rc init:
Line 50: Line 54:
Start the service:
Start the service:


{{Cmd|# rc-service nzb start}}
{{Cmd|# rc-service nzbget start}}


== Notes ==
== Notes ==
Line 56: Line 60:
* 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:
* 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:


{{Cmd|# rc-service nzb start}}
{{Cmd|# rc-service nzbget start}}


{{Cmd|# rc-service nzb stop}}
{{Cmd|# rc-service nzbget stop}}


* Any further configs can be set using the webgui or in {{path|/opt/nzbget/nzbget.conf}}.
* Any further configs can be set using the webgui or in {{path|/opt/nzbget/nzbget.conf}}.

Revision as of 12:35, 15 August 2023

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 on 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:

Contents of /etc/init.d/nzbget

#!/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.

Make the service file executable:

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

Add the service to rc init:

# rc-update add nzbget

Start the service:

# rc-service nzbget 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 nzbget start

# rc-service nzbget 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.