Install from PPA

If for any reason the following steps do not work or you’re just too lazy, you can simply install the latest package versions from the qBittorrent PPA and then skip straight to setting up the daemon or if you want to use it manually skip to setting up mime types for easy Magnet link and torrent handling.

Install Dependencies

  • Get Libtorrent Rasterbar sources (1.1.x)

  • Get qBittorrent sources (4.0.x)

  • Install OS build tools and deps

    sudo apt-get install build-essential cmake qt5-default libboost-dev libboost-system-dev qtbase5-dev qttools5-dev-tools libqt5svg5-dev python \
    geoip-database libgeoip-dev libboost-system-dev libboost-chrono-dev libboost-random-dev libssl-dev git pkg-config automake libtool
Make sure you have enough memory/SWAP. Trying to compile libtorrent rasterbar on 512MB RAM on a t2.nano EC2 instance fails (see Troubleshooting below).

Compile libtorrent-rasterbar

  • Configure project

    ./configure --disable-debug --enable-encryption --prefix=/usr --with-libgeoip=system CXXFLAGS=-std=c++11
  • Compile and install

    make clean
    make -j$(nproc)
    sudo make install

After librasterbar is finished and installed you can start with compiling qbittorrent-nox

Compile qBittorrent

 ./configure --disable-gui
make -j$(nproc)
sudo make install

Set up daemon service

Start qBittorrent once to create the config directory

Make sure you do NOT start this first time while logged in as root. The application will not be able to write to /home/$USER/.local/share/data/qBittorret/ and will crash. Also the config file in /home/$USER/.config/qBitorrent/qBittorrent.conf must be read/writable.

Then cancel out with Ctrl+C

Install service file for systemd

Create a file:

Description=qBittorrent Daemon Service

ExecStart=/usr/bin/qbittorrent-nox -d


Then run

sudo systemctl daemon-reload (1)
sudo systemctl start qbittorrent.service (2)
sudo systemctl enable qbittorrent.service (3)
1 Reload daemon definition files
2 Start qBittorrent service
3 Enable qBittorrent service to start on boot
You can create the service file in a Dropbox and then link the file into the respective directory to migrate it to other machines with the same installation or for easy backup.

Install Torrent Filetype handler

Make sure you update the mime type definitions of gvfs-open and xdg-open after adding the

To make life easier with using qBittorrent-nox and the Webui you can define a handlers for the torrent files and magnet links. Create new files:

[Desktop Entry]
Comment=Headless qBittorrent
Exec=qbittorrent-nox --webui-port=8112 %F %U
[Desktop Entry]
Comment=Headless qBittorrent
Exec=qbittorrent-nox --webui-port=8112 %U

Create symlinks to these files in "/usr/share/applications"

A terminal will pop up shortly because the option Terminal=true is set. This can serve as an indicator that something has actually happened. If you find this annoying simply set Terminal=false.

Update Mime type

gvfs-mime --set application/x-bittorrent qbittorrent-nox-add-file.desktop
gvfs-mime --set x-scheme-handler/magnet qbittorrent-nox-add-link.desktop
xdg-mime default qbittorrent-nox-add-link.desktop x-scheme-handler/magnet
xdg-mime default qbittorrent-nox-add-file.desktop application/x-bittorrent

Add Letsencrypt Cert to qBittorrent WebUI

Go through the procedure of setting up letsencrypt

Once you have the certificate installed and SSL enabled for your webserver you will receive some certificates. These are located in /etc/letsencrypt/live/$DOMAIN. You must then add these to the qBittorrent config as:



libtorrent-rasterbar compilation fails

Error message from libtorrent-rasterbar make
g++: internal compiler error: Killed (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-5/README.Bugs> for instructions.
Makefile:941: recipe for target 'http_connection.lo' failed
make[1]: *** [http_connection.lo] Error 1
make[1]: Leaving directory '/home/ubuntu/libtorrent-rasterbar-1.1.6/src'
Makefile:620: recipe for target 'all-recursive' failed
make: *** [all-recursive] Error 1

The machine ran out of memory during compilation. You need to add more memory or some SWAP.