博客里面此类文章版本实在太多,每次我自己装一遍都要参考两三篇文章也实在是蛋疼,于是整理一下。
Compiler and Depencency
首先是一些依赖包的安装:
# gcc-8 Prerequisites (optional) add-apt-repository ppa:ubuntu-toolchain-r/test # Compiler apt install gcc-8 g++-8 # (optional) apt install build-essential checkinstall pkg-config automake libtool git # Libtorrent Dependency apt install libboost-dev libboost-system-dev libboost-python-dev libboost-chrono-dev libboost-random-dev libssl-dev libgeoip-dev # Deluge Dependency apt install python-pip python-attr python-chardet python-click python-colorama python-openssl python-pam python-pyasn1 python-pyasn1-modules python-serial python-service-identity python-twisted-bin python-twisted-core python-zope.interface python-twisted python-openssl python-setuptools intltool geoip-database python-notify python-pygame python-glade2 librsvg2-common xdg-utils python-mako apt install python-automat python-constantly python-hyperlink python-incremental # Only on Ubuntu 18.04+ (16.04 do not have these packages) # qBittorrent Dependency apt-get install qtbase5-dev qttools5-dev-tools libqt5svg5-dev
libtorrent
考虑到双栈 IP 汇报的问题,仍然使用 libtorrent 1.0.11
首先应该打上 std=c++11 的 patch:
diff -uNr libtorrent/bindings/python/compile_flags.in libtorrent-cpp11/bindings/python/compile_flags.in --- libtorrent/bindings/python/compile_flags.in 2018-04-18 06:49:46.350053702 +0000 +++ libtorrent-cpp11/bindings/python/compile_flags.in 2018-04-18 07:58:13.883000009 +0000 @@ -1 +1 @@ -@COMPILETIME_OPTIONS@ @CPPFLAGS@ @LIBS@ @BOOST_CPPFLAGS@ @BOOST_SYSTEM_LIB@ @BOOST_PYTHON_LIB@ @PTHREAD_LIBS@ @OPENSSL_LIBS@ @OPENSSL_LDFLAGS@ @OPENSSL_INCLUDES@ -I@top_srcdir@/include +@COMPILETIME_OPTIONS@ @CXXFLAGS@ @CPPFLAGS@ @LIBS@ @BOOST_CPPFLAGS@ @BOOST_SYSTEM_LIB@ @BOOST_PYTHON_LIB@ @PTHREAD_LIBS@ @OPENSSL_LIBS@ @OPENSSL_LDFLAGS@ @OPENSSL_INCLUDES@ -I@top_srcdir@/include diff -uNr libtorrent/bindings/python/setup.py libtorrent-cpp11/bindings/python/setup.py --- libtorrent/bindings/python/setup.py 2018-04-18 06:49:46.350053702 +0000 +++ libtorrent-cpp11/bindings/python/setup.py 2018-04-18 07:59:26.123112215 +0000 @@ -104,7 +104,7 @@ library_dirs = parse_cmd(extra_cmd, '-L'), extra_link_args = ldflags.split() + arch(), extra_compile_args = parse_cmd(extra_cmd, '-D', True) + arch() \ - + target_specific(), + + target_specific() + ['-std=c++11'], libraries = ['torrent-rasterbar'] + parse_cmd(extra_cmd, '-l'))] setup(name = 'python-libtorrent',
然后是编译:
git clone https://github.com/arvidn/libtorrent.git libtorrent-1.0.11 git checkout RC_1_0 ./autotool.sh ./configure --enable-python-binding --with-libiconv --disable-debug --enable-encryption --with-libgeoip=system CXXFLAGS=-std=c++11 # if compile on armhf (SoYouStart ARM) # ./configure --enable-python-binding --with-libiconv --disable-debug --enable-encryption --with-libgeoip=system CXXFLAGS=-std=c++11 --with-boost-libdir=/usr/lib/arm-linux-gnueabihf make -j$(nproc) checkinstall ldconfig
Deluge
wget http://download.deluge-torrent.org/source/deluge-1.3.15.tar.gz tar xzvf deluge*.tar.gz python setup.py build python setup.py install --install-layout=deb
注意这个最好别用 checkinstall 安装,可能会导致一些不可预知的错误。
qBittorrent
git clone https://github.com/qbittorrent/qBittorrent.git # git clone https://github.com/c0re100/qBittorrent-Enhanced-Edition.git git checkout <branch> # e.g. v4_1_x; v3_3_x ./configure # ./configure --with-boost-libdir=/usr/lib/arm-linux-gnueabihf make -j$(nproc) checkinstall
systemd Example
deluged.service
$ cat /etc/systemd/system/deluged.service [Unit] Description=Deluged After=network-online.target [Service] ExecStart=/usr/bin/sudo -u <username> /usr/bin/deluged -d ExecStop=/bin/kill -9 $(cat /run/deluged.pid) Restart=always PIDFile=/run/deluged.pid TimeoutStopSec=300 RestartSec=3 [Install] WantedBy=multi-user.target
deluge-web.service
$ cat /etc/systemd/system/deluge-web.service [Unit] Description=Deluge-web After=network-online.target deluged.service Wants=deluged.service [Service] ExecStart=/usr/bin/sudo -u <username> /usr/bin/deluge-web ExecStop=/bin/kill -9 $(cat /run/deluge-web.pid) Restart=always PIDFile=/run/deluge-web.pid RestartSec=3 [Install] WantedBy=multi-user.target
References
https://github.com/qbittorrent/qBittorrent/wiki/Compiling-qBittorrent-on-Debian-and-Ubuntu
https://dev.deluge-torrent.org/wiki/Installing/Source
https://github.com/amefs/QB/blob/master/setup/sources/libtorrent-rasterbar-RC_1_0.patch