NPCHK Blog

路邊小博客(<ゝω・)☆

Ubuntu/Debian Linux編譯qBittorrent安裝指南

前言

以下為安裝最新或指定版本qBittorrent教學。
適用於Ubuntu18或更新版本,Debian10或更新版本
適用於qBittorrent4.1.9-4.3.0.1或更新版本

安裝須知

https://github.com/arvidn/libtorrent
libtorrent是qBittorrent必要的後端程序,對軟件性能有直接影響。

libtorrent 1.0.11: 非常穩定,適合長時間使用,但已經很舊了,不建議使用。
libtorrent 1.1.14: 性能更好,對高速種子比較友好,非常穩定,適合長時間使用,建議使用。
libtorrent 1.2.10: 沒用過,但是小問題應該也修得差不多了,是qBittorrent4.3.0的默認版本
libtorrent 2.0   : 沒用過,應該不穩定,不建議使用

libtorrent 1.0.11: 適用於qBittorrent3.3.11-4.1.3
libtorrent 1.1.14: 適用於qBittorrent4.0.0或更新版本
libtorrent 1.2.10 : 適用於qBittorrent4.2.0或更新版本

qBittorrent 4.1.4或更新版本: 要求libtorrent ≥ 1.1.10
qBittorrent 4.3.0或更新版本: 要求libtorrent ≥ 1.2.0

下面請根據qBittorrent版本安裝所需的libtorrent,如果看不懂的話:
如果你想安裝qBittorrent4.0.0-4.2.5,請安裝libtorrent 1.1.14
如果你想安裝qBittorrent4.3.0或更新版本,請安裝libtorrent 1.2.11

安裝libtorrent

先安裝依賴包:

apt update
apt install build-essential pkg-config automake libtool git libgeoip-dev python3 python3-dev
apt install libboost-dev libboost-system-dev libboost-chrono-dev libboost-random-dev libssl-dev
apt install qtbase5-dev qttools5-dev-tools libqt5svg5-dev zlib1g-dev

安裝libtorrent 1.1.14:

wget https://github.com/arvidn/libtorrent/releases/download/libtorrent-1_1_14/libtorrent-rasterbar-1.1.14.tar.gz
tar xf libtorrent-rasterbar-1.1.14.tar.gz
cd libtorrent-rasterbar-1.1.14
./configure --disable-debug --enable-encryption --with-libgeoip=system
make -j$(nproc)
make install
ldconfig

安裝libtorrent 1.2.11:

wget https://github.com/arvidn/libtorrent/releases/download/v1.2.11/libtorrent-rasterbar-1.2.11.tar.gz
tar xf libtorrent-rasterbar-1.2.11.tar.gz
cd libtorrent-rasterbar-1.2.11
./configure --disable-debug --enable-encryption --with-libgeoip=system CXXFLAGS=-std=c++14
make -j$(nproc)
make install
ldconfig

安裝qBittorrent

https://github.com/qbittorrent/qBittorrent/releases
可自行選擇版本 qBittorrent4.3.1為例

wget https://github.com/qbittorrent/qBittorrent/archive/release-4.3.1.tar.gz
tar xf release-4.3.1.tar.gz
cd qBittorrent-release-4.3.1
./configure --disable-gui --disable-debug
make -j$(nproc)
make install

設置開機自啟

nano /etc/systemd/system/qbittorrent.service

輸入以下內容:

[Unit]
Description=qBittorrent Daemon Service
After=network.target

[Service]
LimitNOFILE=512000
User=root
ExecStart=/usr/local/bin/qbittorrent-nox
ExecStop=/usr/bin/killall -w qbittorrent-nox

[Install]
WantedBy=multi-user.target

啟用以上設置:

systemctl enable qbittorrent.service

啟動qBittorrent(首次啟動請按y確認條款)

qbittorrent-nox

按Ctrl+C退出

後台運行qBittorrent:

systemctl start qbittorrent.service

安裝完成

訪問WebUI:http://你的IPADDRESS:8080/
默認用戶名:admin
默認密碼:adminadmin
關閉qBittorrent命令: systemctl stop qbittorrent.service
啟動qBittorrent命令: systemctl start qbittorrent.service
重啟qBittorrent命令: systemctl restart qbittorrent.service

創建下載文件夾和設置權限

mkdir /home/Downloads
chmod 777 /home/Downloads

把下載路徑設置到/home/Downloads就OK了!







  1. kenneth104表示:

    好神奇,10days前的qB 4.2.1为什么这里也是这个版本 :biggrin:

  2. Kevin表示:

    请问安装QB时,出现下列情况如何解决?
    root@debian10:~/libtorrent-rasterbar-1.2.3/qBittorrent-release-4.2.1# make -j$(nproc)
    cd src/ && ( test -e Makefile || /usr/lib/qt5/bin/qmake -o Makefile /root/libtorrent-rasterbar-1.2.3/qBittorrent-release-4.2.1/src/src.pro -qtconf /usr/lib/x86_64-linux-gnu/qt5/qt.conf -early QMAKE_CC=x86_64-linux-gnu-gcc QMAKE_CXX=x86_64-linux-gnu-g++ QMAKE_LINK=x86_64-linux-gnu-g++ QMAKE_QMAKE=/usr/bin/x86_64-linux-gnu-qmake PKG_CONFIG=x86_64-linux-gnu-pkg-config -before QMAKE_LRELEASE= ) && make -f Makefile
    make[1]: Entering directory '/root/libtorrent-rasterbar-1.2.3/qBittorrent-release-4.2.1/src'
    make[1]: Nothing to be done for 'first'.
    make[1]: Leaving directory '/root/libtorrent-rasterbar-1.2.3/qBittorrent-release-4.2.1/src'

  3. Miku表示:

    其实可以考虑使用screen代替systemd,因为之前有碰到过使用systemd接管qb以后,使用systemd执行qb的重启与关闭时卡死的情况,特别是重启的时候,去过qb的任务特别多的话

  4. Miku表示:

    是systemd卡死,任务无响应。screen的话丢到后台直接kill掉就可以

發佈回覆給「Miku」的留言 取消回覆

發佈留言必須填寫的電子郵件地址不會公開。

這個網站採用 Akismet 服務減少垃圾留言。進一步了解 Akismet 如何處理網站訪客的留言資料