NZBGet

来自 Alpine Linux

简介

  • 本指南解释了如何在 Alpine Linux 上安装流行的服务 NZBGet。具体来说,使用的环境是在 LXC 容器中运行的 3.18 版本。本指南在标准的 Alpine Linux 安装中也应该有效。
  • 本指南将 NZBGet 设置为标准的 rc init 服务。
  • 本指南中使用路径 /opt,但是路径的选择对结果无关紧要,例如,/srv 应该也可以正常工作。
  • 本指南假设所有命令都以 root 用户身份运行,除非另有说明。

下载并安装 nzbget

获取并安装最新的 NZBGet 安装脚本。(如果您有安全方面的担忧,可以在 GitHub 上查看 NZBGet 代码)。

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

运行安装脚本。

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

将 nzbget 目录移动到 /opt}

# mv nzbget /opt/

创建 NZBGet 服务

创建 NZBGet init 文件

/etc/init.d/nzbget 的内容/etc/init.d/nzbget

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

请注意,命令 /opt/nzbget/nzbget -D/opt/nzbget/nzbget -Q 用于干净地启动和停止服务。

使服务文件可执行

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

将服务添加到 rc init

# rc-update add nzbget

启动服务

# rc-service nzbget start

注释

  • 此时,您应该能够通过 http://<YOURIP>:6789 访问 nzbget。您应该能够启动和停止 nzbget 服务,并且该服务应该在系统重启/重新启动后启动

# rc-service nzbget start

# rc-service nzbget stop

  • 任何进一步的配置都可以使用 webgui 或在 /opt/nzbget/nzbget.conf 中设置。
  • 值得注意的是 /opt/nzbget/nzbget.conf 中的这一行

DaemonUsername=root

这允许服务以特定用户身份启动和运行,如果 NZBGet 与其他媒体管理器和共享存储一起使用,这是一个常见的设置。请注意,设置中指定的任何工作目录都需要更新其权限才能正常工作。

  • NZBGet 在其日志中非常详细。检查 NZBGet 的“消息”部分以查找错误,包括权限和路径。

更新 NZBGet

从 21.2 版本开始,NZBGet 附带的用于从 nzbget.net 更新的证书已过期,因此更新将失败,直到证书更新为止。幸运的是,这个问题可以得到纠正

停止 nzbget 服务

# rc-service nzbget stop

如果您以 root 以外的任何其他用户身份运行 nzbget 服务,请暂时将其改回 root 用户,以便在 /opt/nzbget/nzbget.conf 中进行更新

DaemonUsername=root

获取新的有效证书

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

将新证书移动到正确的路径

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

启动 NZBGet 服务

# rc-service nzbget start

导航到您的 NZBGet 实例,设置,系统,更新 NZBGet

nzbget 更新截图

如果需要,再次停止 nzbget 服务,并将 DaemonUsername 恢复为 /opt/nzbget/nzbget.conf 中的正常值。