前言
以下將為Debian 8 (Jessie) 編譯安裝qBittorrent。
教學分為依賴包安裝與編譯qBittorrent/libtorrent兩部份
通過測試於qBitorrent 4.1.5
2019/03/26更新:通過測試於libtorrent 1.1.12 1.2.0 / qBittorrent 4.1.5 4.2.0a
適用於Ubuntu18/Debian9的教學:https://npchk.info/ubuntu-debian-install-qbittorrent/
參考資料:
https://tieba.baidu.com/p/5570353699
https://amefs.net/archives/1613.html
感謝 wdsr20001202 Mimi客 彼音星垠 AMEFS
安裝工具和軟件包
安裝編譯GCC Boost Qt libtorrent qBittorrent的所需組件:
apt update apt install build-essential pkg-config automake libtool git screen libgeoip-dev python3 libgl1-mesa-dev python3-dev libicu-dev libbz2-dev libssl-dev zlib1g-dev
接下來需要編譯的軟件體積巨大且耗時,源碼編譯後約佔10GB空間。
編譯安裝GCC:
wget https://ftp.gnu.org/gnu/gcc/gcc-7.3.0/gcc-7.3.0.tar.xz tar xf gcc-7.3.0.tar.xz cd gcc-7.3.0 ./contrib/download_prerequisites mkdir objdir cd objdir ../configure --enable-checking=release --enable-languages=c,c++ --disable-multilib make -j$(nproc) make install cp /usr/local/lib64/libstdc++.so.6.0.24 /usr/lib/x86_64-linux-gnu/ rm /usr/lib/x86_64-linux-gnu/libstdc++.so.6 ln -s /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.24 /usr/lib/x86_64-linux-gnu/libstdc++.so.6 cd ../.. && rm -rf gcc-7.3.0
編譯安裝Boost:
wget https://dl.bintray.com/boostorg/release/1.65.1/source/boost_1_65_1.tar.bz2 tar xf boost_1_65_1.tar.bz2 cd boost_1_65_1 ./bootstrap.sh --with-libraries=all --prefix=/usr/local ./b2 -j$(nproc) toolset=gcc ./b2 install ldconfig cd .. && rm -rf boost_1_65_1
編譯安裝Qt:
wget https://download.qt.io/archive/qt/5.9/5.9.5/single/qt-everywhere-opensource-src-5.9.5.tar.xz tar xf qt-everywhere-opensource-src-5.9.5.tar.xz cd qt-everywhere-opensource-src-5.9.5 ./configure -release -opensource -confirm-license -strip -shared -ltcg -make libs -make tools -dbus -nomake examples -no-compile-examples -no-qml-debug -no-icu -no-gtk -no-opengles3 -no-angle -no-sql-sqlite -no-sql-odbc -no-sqlite -skip qt3d -skip qtactiveqt -skip qtandroidextras -skip qtcanvas3d -skip qtcharts -skip qtconnectivity -skip qtdatavis3d -skip qtdoc -skip qtgamepad -skip qtgraphicaleffects -skip qtimageformats -skip qtlocation -skip qtmacextras -skip qtmultimedia -skip qtnetworkauth -skip qtpurchasing -skip qtquickcontrols -skip qtquickcontrols2 -skip qtremoteobjects -skip qtscript -skip qtscxml -skip qtsensors -skip qtserialbus -skip qtserialport -skip qtspeech -skip qtvirtualkeyboard -skip qtwayland -skip qtwebchannel -skip qtwebengine -skip qtwebsockets -skip qtwebview -skip qtx11extras -skip qtxmlpatterns make -j$(nproc) make install cd .. && rm -rf qt-everywhere-opensource-src-5.9.5 ###如果出現錯誤:ERROR: The OpenGL functionality tests failed! 可嘗試在./configure加參數 -no-opengl
Qt將安裝在 /usr/local/Qt-5.9.5,設置環境變量:
nano /etc/profile
添加內容
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/local/Qt-5.9.5/lib/pkgconfig export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/Qt-5.9.5/bin
設置生效
source /etc/profile
安裝libtorrent:
wget https://github.com/arvidn/libtorrent/releases/download/libtorrent_1_1_12/libtorrent-rasterbar-1.1.12.tar.gz tar xf libtorrent-rasterbar-1.1.12.tar.gz cd libtorrent-rasterbar-1.1.12 ./configure --disable-debug --enable-encryption --with-libgeoip=system CXXFLAGS=-std=c++11 make -j$(nproc) make install ldconfig cd .. && rm -rf libtorrent-rasterbar-1.1.12
編譯安裝qBittorrent
https://github.com/qbittorrent/qBittorrent/releases
wget https://github.com/qbittorrent/qBittorrent/archive/release-4.1.5.tar.gz tar xf release-4.1.5.tar.gz cd qBittorrent-release-4.1.5 ./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了!