lala.im:Debian9编译安装qBittorrent/Deluge/libtorrent-rasterbar

技術·lala.im · 2018-12-16 · 144 人浏览

原文地址:https://lala.im/4574.html,請支持原作者!該處僅作轉載。

因为qBittorrent/Deluge都依赖于libtorrent-rasterbar,所以编译一个libtorrent-rasterbar之后可以让qBittorrent/Deluge共存,所以这篇文章我同时把两个客户端都装上。
如果是用来刷PT,那么开启BBR很重要,Debian9默认的内核已经是4.9版本,可以直接通过下面的命令开启BBR:

echo "net.core.default_qdisc=fq" >> /etc/sysctl.conf
echo "net.ipv4.tcp_congestion_control=bbr" >> /etc/sysctl.conf
sysctl -p

更新一下源信息:

apt update

更新系统:

apt dist-upgrade

安装编译所需的各种依赖和包:

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

如果待会你要安装Deluge,则还需要安装两个包:

apt -y install libboost-python-dev
apt -y install python-setuptools

如果想节约时间不编译libtorrent-rasterbar,可以用APT安装旧版本(不推荐):

apt-get install libtorrent-rasterbar-dev

现在编译libtorrent-rasterbar最新版,注意配置参数这里开启python绑定(用于Deluge):

wget https://github.com/arvidn/libtorrent/releases/download/libtorrent_1_1_11/libtorrent-rasterbar-1.1.11.tar.gz
tar -xzvf libtorrent-rasterbar-1.1.11.tar.gz
./configure --enable-encryption --enable-python-binding --with-libiconv --with-libgeoip=system CXXFLAGS=-std=c++11
make -j4
make install

完成之后我们就可以来编译安装qBittorrent了:

wget https://github.com/qbittorrent/qBittorrent/archive/release-4.1.4.tar.gz
tar -xzvf release-4.1.4.tar.gz
cd qBittorrent-release-4.1.4
./configure --prefix=/usr --disable-gui CXXFLAGS=-std=c++11
make -j4
make install

完成之后执行下面的命令先启动一次qBittorrent,按Y同意软件协议之后按键盘组合键Ctrl+C退出来。

qbittorrent-nox

新建一个qBittorrent的服务文件:

nano /etc/systemd/system/qbittorrent.service

写入:

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

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

[Install]
WantedBy=multi-user.target

重载systemd配置:

systemctl daemon-reload

然后我们就可以用systemd来管理qBittorrent了:

systemctl start qbittorrent
systemctl enable qbittorrent
systemctl status qbittorrent
systemctl stop qbittorrent

现在来编译安装Deluge,首先用python-setuptools安装pip:

easy_install pip

然后直接用pip去安装Deluge所需的依赖:

pip install twisted pyopenssl simplejson pyxdg chardet geoip setproctitle pillow mako service_identity

现在下载Deluge的源码:

cd /root
wget http://download.deluge-torrent.org/source/deluge-1.3.15.tar.gz
tar -xzvf deluge-1.3.15.tar.gz
cd deluge-1.3.15

编译并完成安装:

python setup.py build
python setup.py install

还是老样子新建一个服务文件,用于deluge的后端:

nano /etc/systemd/system/deluged.service

写入:

[Unit]
Description=Deluge Bittorrent Client Daemon
Documentation=man:deluged
After=network-online.target
[Service]
Type=simple
User=root
Group=root
UMask=007
ExecStart=/usr/local/bin/deluged -d
Restart=on-failure
# Time to wait before forcefully stopped.
TimeoutStopSec=300
[Install]
WantedBy=multi-user.target

再新建一个服务文件用于deluge的WEB服务:

nano /etc/systemd/system/deluge-web.service

写入:

[Unit]
Description=Deluge Bittorrent Client Web Interface
Documentation=man:deluge-web
After=network-online.target deluged.service
Wants=deluged.service
[Service]
Type=simple
User=root
Group=root
UMask=027
# This 5 second delay is necessary on some systems
# to ensure deluged has been fully started
ExecStartPre=/bin/sleep 5
ExecStart=/usr/local/bin/deluge-web
Restart=on-failure
[Install]
WantedBy=multi-user.target

重载systemd配置:

systemctl daemon-reload

使用systemd管理Deluge:

systemctl start deluged
systemctl start deluge-web
systemctl enable deluged
systemctl enable deluge-web
systemctl status deluged
systemctl status deluge-web
systemctl stop deluged
systemctl stop deluge-web

参考文献:
https://github.com/qbittorrent/qBittorrent/wiki/Compiling-qBittorrent-on-Debian-and-Ubuntu\nhttps://dev.deluge-torrent.org/wiki/Installing/Source\nhttps://dev.deluge-torrent.org/wiki/Building/libtorrent\nhttps://dev.deluge-torrent.org/wiki/UserGuide/Service/systemd
哎哟,好像忘记配张图了。。。补一下。。。

範例

BT lala.im
Theme Jasmine by Kent Liao