懒得安装复杂的东西就直接apt install qbittorrent-nox一把梭。

安装所需依赖

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

编译安装libtorrent 1.1.x

libtorrent 1.2.x目前处于developing阶段,可能存在影响正常使用的bug,在实际测试中我也遇到了一些性能问题,所以使用libtorrent 1.1.x是较为稳妥的选择。目前最新版本为1.1.14

git clone https://github.com/arvidn/libtorrent.git
cd libtorrent
git checkout RC_1_1
./autotool.sh
./configure --disable-debug --enable-encryption
make clean
make -j$(nproc)
make install

编译并安装qBittorrent 4.1.9.1

qBittorrent 4.2.x和libtorrent 1.2一样,存在一些bug,部分pt站点暂时禁用了qBittorrent 4.2.x,在qBittorrent 4.2.x解决bug前,依然使用qBittorrent 4.1.x。

git clone https://github.com/qbittorrent/qBittorrent
cd qBittorrent
git checkout v4_1_x
./configure --disable-gui CXXFLAGS="-std=c++14"
make -j$(nproc)
make install
ldconfig

通过systemd运行qBittorrent

在 /etc/systemd/system/ 新建文件

nano /etc/systemd/system/qbittorrent.service
[Unit]
Description=qBittorrent Daemon Service
After=network.target

[Service]
UMask=000 #文件权限
Type=forking
User=root #运行用户
LimitNOFILE=infinity
ExecStart=/usr/local/bin/qbittorrent-nox -d #路径请用which qbittorrent-nox查找
ExecStop=/usr/bin/killall -w -s 9  /usr/local/bin/qbittorrent-nox 
Restart=on-failure
TimeoutSec=300

[Install]
WantedBy=multi-user.target

添加完毕后运行以设置开机启动和运行,默认端口为8080,账户admin,密码adminadmin

systemctl enable qbittorrent.service
systemctl start qbittorrent.service

参考:https://blog.awsl.cloud/?p=29

最后修改:2022 年 08 月 31 日
如果觉得我的文章对你有用,请随意赞赏