Dec 9, 2024 3 min read

NZBGet: A Beginner-Friendly Guide to Self-Hosting

NZBGet: A Beginner-Friendly Guide to Self-Hosting
Table of Contents

NZBGet is a lightweight, high-performance Usenet downloader designed to provide efficient downloading while minimizing resource usage. It excels in speed, customization, and data control, making it a top choice for self-hosting enthusiasts. In this guide, we’ll walk you through installing, configuring, securing, and managing NZBGet, with actionable examples to help you get the most out of your setup.

Installing NZBGet

πŸ“¦ Docker/Docker Compose Setup

Using Docker is a popular and efficient way to deploy NZBGet. Here’s how to set it up with Docker Compose:

  1. Create a docker-compose.yml file for NZBGet:

version: '3.8'

services:

nzbget:

image: linuxserver/nzbget:latest

container_name: nzbget

ports:

- 6789:6789 # NZBGet web interface

environment:

- PUID=1000  # Replace with your user ID

- PGID=1000  # Replace with your group ID

- TZ=Etc/UTC # Set your timezone

volumes:

- /path/to/config:/config # Configuration files

- /path/to/downloads:/downloads # Downloaded files

restart: unless-stopped

  1. Deploy the container:

docker-compose up -d

  1. Verify it’s running:

docker ps | grep nzbget

The NZBGet web interface will now be accessible at http://<your-server-ip>:6789.

πŸš€ Manual Installation

For those who prefer direct installations, follow these steps to manually install NZBGet on a Linux server:

  1. Install dependencies:

sudo apt update

sudo apt install -y wget unzip

  1. Download and install NZBGet:

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

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

./nzbget-latest-bin-linux.run

  1. Start NZBGet:

~/nzbget/nzbget -s

  1. Access the web interface at http://<your-server-ip>:6789 and configure NZBGet as needed.

Configuring Nginx as a Reverse Proxy

🌐 Nginx Configuration

To serve NZBGet with Nginx:

  1. Create an Nginx server block:

server {

listen 80;

server_name nzbget.example.com;

location / {

proxy_pass http://127.0.0.1:6789;

proxy_set_header Host $host;

proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

}

}

  1. Save the file in /etc/nginx/sites-available/nzbget and enable it:

sudo ln -s /etc/nginx/sites-available/nzbget /etc/nginx/sites-enabled/

sudo nginx -t

sudo systemctl reload nginx

πŸ”’ SSL/TLS Setup

Secure your reverse proxy with Let’s Encrypt:

  1. Install Certbot:

sudo apt install -y certbot python3-certbot-nginx

  1. Obtain and apply an SSL certificate:

sudo certbot --nginx -d nzbget.example.com

  1. Automate certificate renewals:

sudo systemctl enable certbot.timer

πŸ› οΈ Testing and Reloading Nginx

Check for syntax errors and reload Nginx to apply changes:


sudo nginx -t

sudo systemctl reload nginx

Logging and Debugging NZBGet

πŸ—ƒοΈ Enabling Debug Logs

To enable detailed logging in NZBGet:

  1. Open the configuration via the web UI or edit nzbget.conf directly.

  2. Set DetailTarget and DetailLevel:


DetailTarget=log

DetailLevel=debug

  1. Restart NZBGet for changes to take effect:

docker restart nzbget # For Docker users

~/nzbget/nzbget -D    # For manual installations

πŸ“„ Viewing Logs

Access logs based on your installation method:

  • Docker:

docker logs nzbget

  • Manual Installation:

tail -f ~/nzbget/nzbget.log

πŸ› οΈ Troubleshooting Common Issues

Scan logs for frequent errors like connection timeouts or missing dependencies. For example:


grep "ERROR" ~/nzbget/nzbget.log

πŸ“€ Exporting Logs

Send logs to an external ELK Stack for advanced analysis:


cat ~/nzbget/nzbget.log | curl -X POST -H "Content-Type: application/json" -d @- http://<elk-endpoint>:9200/nzbget-logs/_doc

Backup and Restore

πŸ—‚οΈ File-Based Backups

Backup configuration files:


tar -czvf nzbget-config-backup.tar.gz /path/to/config

πŸ”„ Restoring Backups

Restore from a configuration backup:


tar -xzvf nzbget-config-backup.tar.gz -C /path/to/config

πŸ“… Automated Backup Scripts

Set up a cron job for periodic backups:


echo "0 2 * * * tar -czvf /path/to/backups/nzbget-config-$(date +\%F).tar.gz /path/to/config" | crontab -

Updating and Upgrading NZBGet

⬆️ Updating Docker Images

Update to the latest NZBGet version in Docker:


docker-compose pull nzbget

docker-compose up -d

πŸ› οΈ Manual Updates

For manual installations, download and rerun the installer:


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

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

./nzbget-latest-bin-linux.run

πŸ” Checking for Updates

Check for updates via the web interface or manually:


curl https://nzbget.net/version-check | grep 'NZBGet-Version'

Leveraging NZBGet’s Unique Features

πŸ”§ Enabling APIs

Activate and use NZBGet’s API for automation:

  1. Enable the API in the web interface or nzbget.conf:

ControlUsername=username

ControlPassword=password

  1. Test the API with curl:

curl -u username:password http://<your-server-ip>:6789/jsonrpc/version

🌟 Advanced Configurations

Optimize NZBGet’s performance by adjusting critical parameters in nzbget.conf, such as:


ArticleCache=200

DownloadQueue=50

Wrapping Up

By following this guide, you’ve successfully set up, secured, and optimized NZBGet for your self-hosting needs. Whether you’re managing your Usenet downloads or integrating advanced features, NZBGet provides the flexibility and power required for efficient downloading. Start implementing these steps now to unlock its full potential!

Great! You’ve successfully signed up.
Welcome back! You've successfully signed in.
You've successfully subscribed to Selfhosted Ninja.
Your link has expired.
Success! Check your email for magic link to sign-in.
Success! Your billing info has been updated.
Your billing was not updated.