Skip to main content

[How-To] Install qBittorrent on Ubuntu 24

Purpose

This how to will focus on explaining steps for qBittorrent installation and basic first time config for a Ubuntu 24 VM.

Prerequisites

List of prerequisites:

  • Sudo user
  • Ubuntu 24 VM

qBittorrent Installation Instructions

Step 1: Update the System

First, update the system by running the following command:

sudo apt update && sudo apt upgrade -y

Step 2: Install qBittorrent Prerequisite Packages

Now, run the following command to install packages needed for qBittorrent install later:

sudo apt install dirmngr ca-certificates software-properties-common apt-transport-https -y

Step 3: Import qBittorrent PPA

Next import the PPA for qBittorrent so we know where to get the install from and what repository for Ubuntu 24:

sudo add-apt-repository ppa:qbittorrent-team/qbittorrent-stable -y

Now that those are added, update the system to see the new available packages/repos:

sudo apt update

Step 4: Install qBittorrent-nox & Web-UI for Ubuntu Headless Server

We are now ready to install qBittorrent. This version will install for headless Ubuntu 24, meaning it won't install an app with a gui, but a app that can be accessed in web browser to get to the gui. This is best suited for headless servers such as our install with no desktop interface. Install with the following command: 

sudo apt install qbittorrent-nox -y

Then, add a new user for qBittorrent with the following command:

sudo adduser --system --group qbittorrent-nox

Add the media group to the vm:

sudo groupadd --gid 1001 media

Add the qbittorrent-nox user to the media group:

sudo adduser qbittorrent-nox media

Now, add the new user to the correct groups, replacing username with your specified username created just above:

sudo adduser your-usernameqbittorrent-nox qbittorrent-nox

Also, once this is done you will have to create the home directories for the qbittorrent user:

sudo usermod -d /home/qbittorrent-nox qbittorrent-nox
sudo mkdir -p /home/qbittorrent-nox
sudo chown -R qbittorrent-nox:qbittorrent-nox /home/qbittorrent-nox

You can now verify that the app is running by manually running the app at a specified port with this line:

sudo -u qbittorrent-nox qbittorrent-nox --webui-port=8080

The other thing this line does is give you the temp password for admin. Login and make sure it works then in system preferences, change the password while in there so you have that for later. Cancel out of that with ctrl-c when testing is completed. Now that your user is ready, create a service for qBittorrent to run on so you don't always have to monitor or manually start the service:

sudo nano /etc/systemd/system/qbittorrent-nox.service

In the config, paste the following code:

[Unit]
Description=qBittorrent Command Line Client
After=network.target

[Service]
Type=simple
User=qbittorrent-nox
Group=qbittorrent-nox
UMask=007
ExecStart=/usr/bin/qbittorrent-nox --webui-port=8080
Restart=on-failure
RestartSec=5
TimeoutStartSec=30

[Install]
WantedBy=multi-user.target

Also, once this is done you will have to create the home directories for the qbittorrent user:

sudo usermod -d /home/qbittorrent-nox qbittorrent-nox
sudo mkdir -p /home/qbittorrent-nox
sudo chown -R qbittorrent-nox:qbittorrent-nox /home/qbittorrent-nox

Step 5: Start qBittorrent Services

We are now ready to start the qBittorrent services. Do so with the following command:

sudo systemctl daemon-reload
sudo systemctl start qbittorrent-nox
sudo systemctl enable qbittorrent-nox

Check the service is running and functioning correctly with this command, should show active green:

systemctl status qbittorrent-nox

Login now in your web browser at either the dns name or ip address and the port 8080.

Step 6: Configure a Web Server for qBittorrent Web UI

While this step isn't needed, its always nice to now have to remember to go to a port when browsing to a service. We'll install apache web server and setup to point to itself on a specified dns name at 8080. Then, when you are done you can just browse directly to the ip or dns name. Start by installing apache web server:

sudo apt update
sudo apt install -y apache2

Now, setup the plugins needed:

sudo a2enmod proxy proxy_http proxy_balancer lbmethod_byrequests
sudo systemctl restart apache2

Next, create the config file for the site:

sudo nano /etc/apache2/sites-available/qbittorrent.conf

Config file contents, replacing domain with dns name for qbittorrent:

<VirtualHost *:80>
    ServerName qbittorrent.example.com

    ProxyPreserveHost On
    ProxyPass / http://127.0.0.1:8080/
    ProxyPassReverse / http://127.0.0.1:8080/

    ErrorLog ${APACHE_LOG_DIR}/qbittorrent_error.log
    CustomLog ${APACHE_LOG_DIR}/qbittorrent_access.log combined

    <Location "/">
        Require all granted
    </Location>
</VirtualHost>

Enable the new site:

sudo a2ensite qbittorrent.conf

Restart apache service:

sudo systemctl reload apache2

Now, you can browse directly to your web ui.