一、安装编译环境

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

二、安装打包工具

apt -y install ruby ruby-dev rubygems build-essential
gem install fpm

三、编译打包 libtorrent-rasterbar

wget https://github.com/arvidn/libtorrent/releases/download/libtorrent_1_2_7/libtorrent-rasterbar-1.2.7.tar.gz
tar -xvf libtorrent-rasterbar-1.2.7.tar.gz
cd libtorrent-rasterbar-1.2.7
./configure --enable-encryption --disable-debug CXXFLAGS="-std=c++14"
make -j$(nproc)

不打包直接安装的话执行:
make install
ldconfig -v

打包的话在 make 后不要执行 make install,换成下面的命令,将 libtorrent-rasterbar 安装到临时目录:
mkdir -p /tmp/libtorrent-rasterbar
make install DESTDIR=/tmp/libtorrent-rasterbar

之后使用 fpm 创建 deb:
fpm -s dir -t deb -C /tmp/libtorrent-rasterbar -m "user " --url "https://domain.com" --description "Development files for libtorrent-rasterbar" --vendor "user" -n libtorrent-rasterbar -v 1.2.7 -p libtorrent-rasterbar_1.2.7_amd64.deb usr/local

此时目录下会有个 libtorrent-rasterbar_1.2.7_amd64.deb
接着安装:dpkg -i libtorrent-rasterbar_1.2.7_amd64.deb

四、编译打包 qBittorrent

wget https://github.com/qbittorrent/qBittorrent/archive/release-4.2.5.zip
unzip release-4.2.5.zip
cd qBittorrent-release-4.2.5
./configure --prefix=/usr --disable-gui CXXFLAGS="-std=c++14"
make -j$(nproc)

同理,不打包直接安装的话执行:
make install
ldconfig -v

打包的话在 make 后不要执行 make install,换成下面的命令,将 qbittorrent-nox 安装到临时目录:
mkdir -p /tmp/qbittorrent-nox
make install INSTALL_ROOT=/tmp/qbittorrent-nox

之后使用 fpm 创建 deb:
fpm -s dir -t deb -C /tmp/qbittorrent-nox -m "user " --url "https://domain.com" --description "bittorrent client based on libtorrent-rasterbar (without X support)" --vendor "user" -n qbittorrent-nox -v 4.2.5 -p qbittorrent-nox_4.2.5_amd64.deb -d "libtorrent-rasterbar >= 1.2.7" -d "zlib1g-dev >= 1:1.2.0" -d "libstdc++6 >= 5.2" -d "libqt5xml5 >= 5.2.0" -d "libqt5network5 >= 5.9.0~beta" -d "libqt5core5a >= 5.11.0~rc1" -d "libboost-system1.67.0" usr/

ps:zlib1g-dev、libstdc++6、libqt5xml5、libqt5network5、libqt5core5a、libboost-system 根据第 1 步安装完成的实际版本号填写

五、配置 Systemd Service

nano /etc/systemd/system/qbittorrent.service

[Unit]
Description=qBittorrent Daemon Service
Documentation=man:qbittorrent-nox(1)
Wants=network-online.target
After=network-online.target nss-lookup.target

[Service]
Type=simple
User=root
ExecStart=/usr/bin/qbittorrent-nox
TimeoutStopSec=infinity

[Install]
WantedBy=multi-user.target

开启启动:systemctl enable qbittorrent
取消开机启动:systemctl disable qbittorrent
启动:systemctl start qbittorrent
状态:systemctl status qbittorrent
停止:systemctl stop qbittorrent

六、Nginx 反代 qBittorrent-nox

location / {
    proxy_pass https://0.0.0.0:8080/;
    proxy_hide_header Content-Security-Policy;
    proxy_set_header    X-Real-IP           $remote_addr;
    proxy_set_header    X-Forwarded-Host    $server_name:$server_port;
    proxy_set_header    X-Forwarded-For     $proxy_add_x_forwarded_for;
    proxy_set_header    X-Forwarded-Proto   $scheme;
    proxy_set_header    X-Forwarded-Ssl     on;    
    proxy_set_header   Referer           '';
    proxy_set_header   Origin            '';
    proxy_hide_header       Referer;
    proxy_hide_header       Origin;
    add_header         X-Frame-Options   "SAMEORIGIN"; 
}

七、重置密码

nano ~/.config/qBittorrent/qBittorrent.conf

找到 WebUI\Password_PBKDF2 这一行删除重启 qbittorrent

注:一 ~ 四转自:萝莉论坛

Last modification:July 1st, 2020 at 05:01 pm
如果觉得我的文章对你有用,请随意赞赏