Skip to content

Instantly share code, notes, and snippets.

@ckcr4lyf
Last active May 20, 2021 04:58
Show Gist options
  • Save ckcr4lyf/7b5aea74f0cb23939cd2aa230276b37e to your computer and use it in GitHub Desktop.
Save ckcr4lyf/7b5aea74f0cb23939cd2aa230276b37e to your computer and use it in GitHub Desktop.
Installing qbittorrent on USB

qBittorrent on USB Shared Boxes

This guide needs basic terminal (SSH) knowledge.

Setup

cd ~/.apps
wget https://github.com/userdocs/qbittorrent-nox-static/releases/download/release-4.3.1_v1.2.11/amd64-glibc-qbittorrent-nox -O qbittorrent-nox
chmod +x qbittorrent-nox
./qbittorrent-nox

A prompt will pop up asking you to enter 'y', do it. It will then probably fail to bind to a port, even if it does, kill it with Ctrl+C.

Binding to a port of our choosing

Run

app-ports show

This will show a list of ports reserved for you. Pick one between the smallest and largest which is not reserved. For this example, I will pick 11280.

We will now modify the config to bind to this port

cd ~/.config/qBittorrent/

Then open qBittorrent.conf in an editor. Under [Preferences], add the following lines:

WebUI\Address=127.0.0.1
WebUI\Port=11280
WebUI\Username=YOUR_DESIRED_USERNAME

Replace port with what you chose earlier, and username with your own. Save the file.

Setup qBittorrent as a service

Make the service file

cd ~/.config/systemd/user
touch qbittorrent.service

Open up qbittorrent.service in an editor, and paste in the following:

REPLACE "homexx" and "username" with the complete path to your home directory!

[Unit]
Description=qBittorrent-nox service
Documentation=man:qbittorrent-nox(1)
Wants=network-online.target
After=network-online.target nss-lookup.target

[Service]
Type=exec
ExecStart=/homexx/username/.apps/qbittorrent-nox"

[Install]
WantedBy=default.target

Then reload the daemon and enable service:

systemctl --user daemon-reload
systemctl --user enable --now qbittorrent.service

Check if its running with

systemctl --user status qbittorrent.service

Setup nginx for qbittorrent

cd ~/.apps/nginx/proxy.d
touch qbittorrent.conf

Then open qbittorrent.conf in an editor, and add the following (REPLACE 11280 WITH YOUR PORT!!!)

location /qbit/ {
    proxy_pass         http://127.0.0.1:11280/;
    proxy_http_version 1.1;
    proxy_set_header   X-Forwarded-Host $http_host;
    http2_push_preload on;
}

Then reload nginx with:

systemctl --user reload nginx.service

Fix password

The default password is adminadmin. To change it, visit https://username.lwXXX.usbx.me/qbit/ Enter the username you set initially in config, and for password enter adminadmin.

Then in settings -> WebUI, you can change the password. You can also change other settings if needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment