root@myserver:/qbittorrent/install#
Step 9: Install and Configure qBittorrent
qBittorrent is a powerful and lightweight torrent client. We'll install the server (headless) version called qbittorrent-nox
, which works without a graphical desktop.
1. Install qBittorrent-NOX:
user@homeserver:~$ sudo apt install qbittorrent-nox -y
- sudo — Run the command with administrator privileges.
- apt — The package manager for Ubuntu.
- install — Command to install a package.
- qbittorrent-nox — The name of the software package.
- -y — Automatically say “yes” to all prompts (no need to confirm manually).
This command installs the server version of qBittorrent and automatically accepts the installation without asking for confirmation.
2. Start qBittorrent manually:
user@homeserver:~$ qbittorrent-nox
You’ll see a message like this in your terminal:
******** Information ********
To control qBittorrent, access the Web UI at: http://localhost:8080
The Web UI administrator username is: admin
The Web UI administrator password was not set. A temporary password is provided for this session: YOUR PASSWORD HERE
Open a browser on another device and go to http://YOUR_LOCAL_IP_ADDRESS:8080
. Login with username admin
and the temporary password. Then change the password in Preferences → Web UI.
After setting the password, return to the terminal and press Ctrl + C
to stop the program. We’ll now set it up to run automatically in the background.
3. Create a systemd service:
user@homeserver:~$ sudo nano /etc/systemd/system/qbittorrent.service
- sudo - run the command as administrator (root access).
- nano - a simple text editor for the terminal.
- /etc/systemd/system/qbittorrent.service - systemd service file for qbittorrent.
This creates a service file that will tell the system how to run qBittorrent in the background on boot.
Insert this content:
[Unit]
Description=qBittorrent Command Line Client (No GUI)
After=network.target
[Service]
Type=simple
User=user
ExecStart=/usr/bin/qbittorrent-nox
Restart=on-failure
RestartSec=5
[Install]
WantedBy=multi-user.target
Change User=user
to match your actual Linux username.
Explanation:
Description=
— short description of the service
After=network.target
— ensures network is ready before starting
Type=simple
— runs the process directly
User=
— defines which user will run the service
ExecStart=
— path to the qBittorrent command
Restart=on-failure
— restart if it crashes
RestartSec=5
— wait 5 seconds before restarting
WantedBy=multi-user.target
— start on normal system boot
Save and exit: Ctrl + O → Enter → Ctrl + X
4. Reload systemd and enable the service:
user@homeserver:~$ sudo systemctl daemon-reload
- sudo — “Superuser do”. Runs the command with administrator rights.
- systemctl - controls system services.
- daemon-reload - reloads system manager configuration.
This reloads all service definitions so your new file is recognized.
user@homeserver:~$ sudo systemctl enable qbittorrent.service
- sudo — “Superuser do”. Runs the command with administrator rights.
- systemctl — Controls system services (start, stop, status, etc.)
- enable — Sets a service to start automatically at boot.
- qbittorrent.service — The name of the software package.
Enable the service to start automatically when the system boots.
user@homeserver:~$ sudo systemctl start qbittorrent.service
- sudo — “Superuser do”. Runs the command with administrator rights.
- systemctl — Controls system services (start, stop, status, etc.)
- start — Starts a service.
- qbittorrent.service — The name of the software package.
Start the qBittorrent service right now.
user@homeserver:~$ sudo systemctl status qbittorrent.service
- sudo — “Superuser do”. Runs the command with administrator rights.
- systemctl — Controls system services (start, stop, status, etc.)
- status — Requests the current state of the SSH service
- qbittorrent.service — The name of the software package.
Check if it’s running correctly. You should see active (running)
in green text.
5. Move downloaded files to MiniDLNA folder:
user@homeserver:~$ sudo mv /home/user/Downloads/* /mnt/usbdrive/media
- sudo — “Superuser do”. Runs the command with administrator rights.
- mv — Move - transfer files from one location to another
- /home/user/Downloads/* — From this folder (* means everything).
- /mnt/usbdrive/media — To this folder.
This moves all downloaded files into the folder where MiniDLNA can stream them. Replace user
with your actual username.
6. Refresh MiniDLNA:
user@homeserver:~$ sudo systemctl restart minidlna
- sudo — “Superuser do”. Runs the command with administrator rights.
- systemctl - controls system services.
- restart - stops and starts the service to reload settings.
- minidlna - the name of the service.
This tells MiniDLNA to rescan the folder and update the media library.
7. Automate this process with a script:
Create a script to do everything automatically:
user@homeserver:~$ sudo nano /usr/local/bin/move-and-refresh.sh
- sudo - run the command as administrator (root access).
- nano - a simple text editor for the terminal.
- /usr/local/bin/move-and-refresh.sh - Target file.
Insert this code:
#!/bin/bash
mv /home/user/Downloads/* /mnt/usbdrive/media/
systemctl restart minidlna
Save it: Ctrl + O → Enter → Ctrl + X
Make it executable:
user@homeserver:~$ sudo chmod +x /usr/local/bin/move-and-refresh.sh
- sudo - Run the command as administrator (root access).
- chmod - Change permission of a file.
- +x - Add execute permission, makes the script runnable.
- /usr/local/bin/move-and-refresh.sh - Target file.
Now you can run this script anytime:
user@homeserver:~$ sudo /usr/local/bin/move-and-refresh.sh
8. Schedule this task daily:
Edit your crontab:
user@homeserver:~$ crontab -e
- crontab -e - This command opens the crontab file (cron table) for the current user in edit mode — allowing you to schedule automatic tasks (called cron jobs) on your Linux system.
If asked, choose nano
as the editor.
Add this line at the bottom:
0 3 * * * /usr/local/bin/move-and-refresh.sh
This will run the script every day at 3:00 AM.
Save and exit: Ctrl + O → Enter → Ctrl + X