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.

If you run into trouble or errors at any step, check the Troubleshooting section at the bottom of the page before posting an issue.

Table of ContentsRequired dependenciesLibtorrentCompiling qBittorrent (with the GUI)Compiling qBittorrent (without the GUI; aka qBittorrent-nox aka headless)TroubleshootingCompiling (generic)Compiling libtorrentCompiling qBittorrentRunning qBittorrentNotes

Required dependencies

  • General required dependencies
 sudo apt-get install build-essential pkg-config automake libtool git zlib1g-dev
 sudo apt-get install libboost-dev libboost-system-dev libboost-chrono-dev libboost-random-dev libssl-dev libgeoip-dev
  • Qt libraries

qBittorrent 4.0 – 4.1.x requires at least Qt 5.5.1, and qBittorrent 4.2 and later requires at least Qt 5.9.

Note that Qt libraries in Debian 8/9 repository is too old for compiling newer qBittorrent, you need to upgrade your system to Debian 10, or install newer Qt libraries by the other way.

If you were using Ubuntu 16.04 LTS, you could add this PPA:

 sudo add-apt-repository ppa:beineri/opt-qt597-xenial
 sudo apt-get update
 sudo apt-get install qt59base qt59svg qt59tools
 export PATH=/opt/qt59/bin:$PATH
 export PKG_CONFIG_PATH=/opt/qt59/lib/pkgconfig:$PKG_CONFIG_PATH

For Debian 10, Ubuntu 18.04 LTS or later, just install Qt from repository

 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

Choose the appropriate git and compile command according to the version of libtorrent you need:

libtorrent versionqBittorrent version supportgit commandCompile commands (after running the git command, choose between using autotools or CMake)
autotoolsCMake
1.2.*>= 4.2.0git checkout RC_1_2./autotool.sh ./configure –disable-debug –enable-encryption CXXFLAGS=”-std=c++14″mkdir -p cmake-build-dir/release && cd cmake-build-dir/release cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_STANDARD=14 -G “Unix Makefiles” ../..
1.1.*>= 3.3.8git checkout RC_1_1./autotool.sh ./configure –disable-debug –enable-encryptionmkdir -p cmake-build-dir/release && cd cmake-build-dir/release cmake -DCMAKE_BUILD_TYPE=Release -G “Unix Makefiles” ../..
1.0.*<= 4.1.5git checkout RC_1_0./autotool.sh ./configure –disable-debug –enable-encryptionmkdir -p cmake-build-dir/release && cd cmake-build-dir/release cmake -DCMAKE_BUILD_TYPE=Release -G “Unix Makefiles” ../..

Now you’re ready to compile:

 make clean && make -j$(nproc)

Finally, you can install libtorrent.

If you have checkinstall, the following command will generate and install a .deb package that can be tracked and managed by your package manager:

 sudo checkinstall --nodoc --backup=no --deldesc --pkgname libtorrent-rasterbar --pkgversion 1.2.3-source-compile # change the version to your liking

Alternatively, the traditional way will do just fine:

 sudo make install

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 the git repository:

  git clone https://github.com/qbittorrent/qBittorrent

If you clone the git repository and want to use the stable current version (rather than the development version which may not work), you need to checkout the stable branch. You can do this in two ways:

By checking out the stable branch (4.1.x at the time of writing):

  cd qBittorrent
  git checkout v4_1_x

Or by checking out the latest tagged stable release (4.1.5 at the time of writing):

  cd qBittorrent
  git checkout release-4.1.5

Enter the folder in a new terminal window and run:

 ./configure
 make -j$(nproc)

Finally, you can install qBittorrent:

If you have checkinstall, the following command will generate and install a .deb package that can be tracked and managed by your package manager:

 sudo checkinstall --nodoc --backup=no --deldesc --pkgname qbittorrent --pkgversion 4.2.1-source-compile # change the version to your liking

Alternatively, the traditional way will do just fine:

 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 the git repository:

  git clone https://github.com/qbittorrent/qBittorrent
  cd qBittorrent

If you clone the git repository and want to use the stable current version (rather than the development version), you need to checkout the stable branch.

 git checkout v4_1_x

(Note: When the stable version changes to 4.2.0, the stable branch will change to v4_2_x.)

Enter the folder in a new terminal window and run:

 ./configure --disable-gui CXXFLAGS="-std=c++14"
 make -j$(nproc)

Finally, you can install qBittorrent:

If you have checkinstall, the following command will generate and install a .deb package that can be tracked and managed by your package manager:

 sudo checkinstall --nodoc --backup=no --deldesc --pkgname qbittorrent-nox --pkgversion 4.2.1-source-compile # change the version to your liking

Alternatively, the traditional method will do just fine:

 sudo make install

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

Documentation about running qBittorrent without GUI is available here.

Troubleshooting

Compiling (generic)

  • In the make command, the -j$(nproc) flag makes the number of build jobs equal to the number of threads available; increasing it may make the build faster, but an eye must be kept on the memory usage.

Compiling libtorrent

  • 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

Compiling qBittorrent

  • 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.
  • 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

Running qBittorrent

If you get an error similar to qbittorrent: symbol lookup error: qbittorrent: undefined symbol: Simply run:

 ldconfig

The following method is too complex, but if you want to know what’s going on, then you can read the following method (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}

Notes

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

Refer: https://github.com/qbittorrent/qBittorrent/wiki/Compiling-qBittorrent-on-Debian-and-Ubuntu#Compiling_qBittorrent_with_the_GUI


0 条评论

发表回复

Avatar placeholder

您的电子邮箱地址不会被公开。 必填项已用 * 标注

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据