NZBGet: Difference between revisions

From Alpine Linux
(Initial page setup for nzbget install under Alpine Linux 3.18)
 
(fixed title casing)
 
(4 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{TOC right}}
{{TOC right}}


= Introduction =
== Introduction ==


* This guide explains how to install the popular service [https://nzbget.net/ 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 explains how to install the popular service [https://nzbget.net/ 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.
* This guide sets up NZBGet as a standard rc init service.
* The path {{path|/opt}} is used in this guide, however the choice of path is immaterial to the outcome, for example, {{path|/srv}} should work fine.
* The path {{path|/opt}} is used in this guide, however the choice of path is immaterial to the outcome, for example, {{path|/srv}} should work fine.
* This guide assumes all commands are run as root unless specified.
* This guide assumes all commands are run as root unless specified.
Line 10: Line 10:
== Download and install nzbget ==
== Download and install nzbget ==


Fetch and install the latest nzbget install script. (If you have security concerns, nzbget code is available to inspect at [https://github.com/nzbget/nzbget github]).
Fetch and install the latest NZBGet install script. (If you have security concerns, NZBGet code is available to inspect on [https://github.com/nzbget/nzbget GitHub]).


<code>wget https://nzbget.net/download/nzbget-latest-bin-linux.run</code>
{{Cmd|$ wget https://nzbget.net/download/nzbget-latest-bin-linux.run}}


Run the install script.
Run the install script.


<code>chmod +x nzbget-latest-bin-linux.run</code>
{{Cmd|$ chmod +x nzbget-latest-bin-linux.run && ./nzbget-latest-bin-linux.run}}
<code>./nzbget-latest-bin-linux.run</code>


Move the nzbget directory to {{path|/opt}}}
Move the nzbget directory to {{path|/opt}}}


<code>mv nzbget /opt/</code>
{{Cmd|# mv nzbget /opt/}}


= Create nzbget service=
== Create NZBGet Service ==


Create the nzbget init file:
Create the NZBGet init file:


<code>vi /etc/init.d/nzbget</code>
{{Cat|/etc/init.d/nzbget|#!/sbin/openrc-run
 
With the following content:
 
<pre>
#!/sbin/openrc-run
   
   
depend() {
depend() {
Line 45: Line 39:
/opt/nzbget/nzbget -Q
/opt/nzbget/nzbget -Q
}
}
</pre>
}}


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:


<code>rc-update add nzbget</code>
{{Cmd|# rc-update add nzbget}}


Start the service:
Start the service:


<code>rc-service nzb start</code>
{{Cmd|# rc-service nzbget start}}


== Notes ==
== Notes ==
Line 61: Line 59:
* 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:


<code>rc-service nzb start</code>
{{Cmd|# rc-service nzbget start}}
<code>rc-service nzb stop</code>


* Any further configs can be set using the webgui or in /opt/nzbget/nzbget.conf.
{{Cmd|# rc-service nzbget stop}}
* Of note is the line
 
* Any further configs can be set using the webgui or in {{path|/opt/nzbget/nzbget.conf}}.
* Of note is the line in {{path|/opt/nzbget/nzbget.conf}}:


<code>DaemonUsername=root</code>
<code>DaemonUsername=root</code>


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.
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.
* NZBGet is quite descriptive in its logs. Check NZBGet's '''Messages''' section for errors, including permissions and paths.


== Updating nzbget ==
== 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:
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:
Stop the nzbget service:


<code>rc-service nzbget stop</code>
{{Cmd|# 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 {{{path|/opt/nzbget/nzbget.conf}}:
If you run the nzbget service under any other user than root, change this back to root temporarily for the update in {{path|/opt/nzbget/nzbget.conf}}:


<code>DaemonUsername=root</code>
<code>DaemonUsername=root</code>
Line 86: Line 85:
Fetch the new and valid certificate:
Fetch the new and valid certificate:


<code>curl --remote-name --time-cond cacert.pem https://nzbget.net/info/cacert.pem</code>
{{Cmd|$ curl --remote-name --time-cond cacert.pem https://nzbget.net/info/cacert.pem}}


Move the new certificate to the correct path:
Move the new certificate to the correct path:


<code>mv cacert.pem /opt/nzbget/cacert.pem</code>
{{Cmd|# mv cacert.pem /opt/nzbget/cacert.pem}}
 
Start the nzbget service:
 
<code>rc-service nzbget start</code>
 
Navigate to your instance of nzbget, Settings, System, Update NZBGet:
 
[[File:2023-07-04 01-07.png|thumb|left|nzbget update screenshot]]
<br />
 
 
 
 
 
 
 


Start the NZBGet service:


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


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


[[File:2023-07-04 01-07.png|thumb|right|100px|nzbget update screenshot]]


If required, stop the nzbget service again and revert the <code>DaemonUsername</code> to its normal value in {{path|/opt/nzbget/nzbget.conf}}.


If required, stop the nzbget service again and revert the DaemonUsername to its normal value in {{path|/opt/nzbget/nzbget.conf}}:
<code>rc-service nzbget stop</code><br>
<code>DaemonUsername=root</code>
and start the service again:
<code>rc-service nzbget start</code>


[[category:Networking]]
[[category:Networking]]

Latest revision as of 07:15, 22 September 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.