Compiling qBittorrent on Debian and Ubuntu

David Pache edited this page Feb 2, 2018 · 46 revisions
Clone this wiki locally

Only follow this guide if you know what you are doing and this is what you really want.
If you are looking only for the latest version of qBittorrent, just head to the download page and use our PPAs.

This how-to will guide you though the compilation of qBittorrent and libtorrent-rasterbar.
This guide is written for Debian/Ubuntu, but the process should be similar for other Debian-derivatives distributions.

Table of Contents

Required dependencies

  • General required dependencies
 sudo apt-get install build-essential pkg-config automake libtool git
 sudo apt-get install libboost-dev libboost-system-dev libboost-chrono-dev libboost-random-dev libssl-dev
  • Qt libraries
 sudo apt-get install qtbase5-dev qttools5-dev-tools libqt5svg5-dev
  • Python (Run time only dependency, for the search engine)
 sudo apt-get install python3

Libtorrent

Libtorrent is a library written by Arvid Norberg that qBittorrent depends on.
It is necessary to compile and install libtorrent before compiling qBittorrent.

Install Libtorrent dev pkg from repository

 sudo apt-get install libtorrent-rasterbar-dev

or use git repo and compile Libtorrent yourself.

Clone from the repo

 git clone https://github.com/arvidn/libtorrent.git
 cd libtorrent

If you want to use libtorrent 1.1.* (Also see: issue 6132)

 git checkout $(git tag | grep libtorrent-1_1_ | sort -t _ -n -k 3 | tail -n 1)
 ./autotool.sh
 ./configure --disable-debug --enable-encryption --with-libgeoip=system CXXFLAGS=-std=c++11

If you want to use libtorrent 1.0.*

 git checkout $(git tag | grep libtorrent-1_0_ | sort -t _ -n -k 3 | tail -n 1)
 ./autotool.sh
 ./configure --disable-debug --enable-encryption --with-libgeoip=system CXXFLAGS=-std=c++11

If you get a configure: error: Boost.System library not found, check if you installed all the above dependencies.
If yes, add --with-boost-libdir=/usr/lib/i386-linux-gnu

Now you're ready to compile:

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

See note in the next section regarding the build jobs.

For more information on building libtorrent, see libtorrent downloading and building.

Compiling qBittorrent (with the GUI)

First, obtain the qBittorrent source code.
Either download and extract a .tar archive from Sourceforge or clone this git repo: git clone https://github.com/qbittorrent/qBittorrent
Enter the folder in a new terminal window and run:

 ./configure
 make -j$(nproc)
  • Note 1: If you're using libtorrent-rasterbar from the 0.16.x series, you also need to pass the --with-libtorrent-rasterbar0.16 option to configure. qBittorrent v3.3.x has dropped the support of libtorrent 0.16.x.
  • Note 2: If you want to compile with qt4 instead of qt5, you also need to pass the --with-qt4 option to configure. qBittorrent v4.0.x has dropped the support of qt4
  • Note 3: This build uses a conservative number of jobs (equal to the threads available); increasing it may make the build faster, but an eye must be kept on the memory usage.
And finally to install qBittorrent:
 sudo make install

That's it! qBittorrent should now be installed. You can now run qBittorrent using the following command:

 qbittorrent

Compiling qBittorrent (without the GUI; aka qBittorrent-nox aka headless)

First, obtain the qBittorrent source code.
Either download and extract a .tar archive from Sourceforge or clone this git repo: git clone https://github.com/qbittorrent/qBittorrent
Enter the folder in a new terminal window and run:

 ./configure --disable-gui
 make -j$(nproc)
  • Note 1: If you're using libtorrent-rasterbar from the 0.16.x series, you also need to pass the --with-libtorrent-rasterbar0.16 option to configure. qBittorrent v3.3.x has dropped the support of libtorrent 0.16.x.
  • Note 2: If you want to compile with qt4 instead of qt5, you also need to pass the --with-qt4 option to configure. qBittorrent v4.0.x has dropped the support of qt4
  • Note 3: This build uses a conservative number of jobs (equal to the threads available); increasing it may make the build faster, but an eye must be kept on the memory usage.
And finally to install qBittorrent:
 sudo make install

If everything went fine, there is one last thing you need to do (see https://github.com/qbittorrent/qBittorrent/issues/8047):

Check if your LD_LIBRARY_PATH environment variable is set and the path /usr/local/lib is included.

Simply run env in your terminal and look for LD_LIBRARY_PATH. If so, you are good to go. If not, add the path to the variable:

  export LD_LIBRARY_PATH=/usr/local/lib:${LD_LIBRARY_PATH}

That's it! qBittorrent-nox should now be installed. You can now run qBittorrent-nox using the following command:

 qbittorrent-nox

Since you disabled the graphical user interface, qBittorrent can only be controlled via its WebUI. If you haven't disabled authentication, as a default, you can access it at:

 http://localhost:8080
 Username: admin
 Password: adminadmin

A documentation about running qBittorrent without GUI is available here.

Notes

  • If you experience any problem with this how to, do not hesitate to contact me at sledgehammer999(at)qbittorrent(dot)org.