Debian/Ubuntu安装qBitTorrent和Flexget实现RSS订阅自动下载

apt安装

支持:Debian/Ubuntu
说明:因为源更新较慢,所以此方法安装的版本较低,目前好像是4.1.5版本;

## 更新系统
apt-get update

## 安装 qBitTorrent
apt install qbittorrent-nox

## 运行 qBitTorrent(默认端口:8080)
qbittorrent-nox

## 指定端口运行(XXXX为自行设置端口)
qbittorrent-nox --webui-port=XXXX

## 挂载到后台运行
nohup qbittorrent-nox &

默认端口:8080 / 默认登录账号:admin / 默认登录密码:adminadmin

编译安装

支持:Debian/Ubuntu
说明:版本可以自选择,但安装比较耗费时间;
升级系统

apt update && apt upgrade
apt install automake build-essential libtool pkg-config

安装 libtorrent
GitHub:https://github.com/arvidn/libtorrent/releases

apt install libssl-dev libgeoip-dev libboost-dev libboost-system-dev libboost-chrono-dev libboost-random-dev
cd /usr/local/src
wget https://github.com/arvidn/libtorrent/releases/download/v1.2.14/libtorrent-rasterbar-1.2.14.tar.gz
tar zxvf libtorrent-rasterbar-1.2.14.tar.gz
cd libtorrent-rasterbar-1.2.14
./configure --disable-debug --enable-encryption --with-libgeoip=system
make -j $(nproc)
make install
ldconfig

安装 qbittorrent
GitHub:https://github.com/qbittorrent/qBittorrent/releases

apt install qtbase5-dev qttools5-dev-tools libqt5svg5-dev zlib1g-dev
cd /usr/local/src
wget https://github.com/qbittorrent/qBittorrent/archive/refs/tags/release-4.3.5.tar.gz
tar zxvf release-4.3.5.tar.gz
cd qBittorrent-release-4.3.5
./configure --disable-gui --disable-debug
make -j$(nproc)
make install

启动 qbittorrent

## 启动
qbittorrent-nox

## 首次启动 请安 y 接受确认,再按 Ctrl+c 退出

后台运行

cat << "EOF" > /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
EOF

启用服务

systemctl enable qbittorrent.service

systemctl start qbittorrent.service

默认端口:8080 / 默认登录账号:admin / 默认登录密码:adminadmin

安装已编译版本

支持:Debian/Ubuntu
说明:速度快,版本新,推荐此方法安装;
密码:admin / adminadmin
配置文件:/root/.config/qBittorrent/qBittorrent.conf
GitHub:https://github.com/userdocs/qbittorrent-nox-static/releases
x86_64 - 版本:qbittorrent 4.3.6 libtorrent 2.0.4

wget https://github.com/userdocs/qbittorrent-nox-static/releases/download/release-4.3.6_v2.0.4/x86_64-qbittorrent-nox

chmod +x x86_64-qbittorrent-nox

// 启动qbittorrent
./x86_64-qbittorrent-nox -d

// 关闭qbittorrent
killall x86_64-qbittorrent-nox

x86_64 - 版本:qbittorrent 4.3.6 libtorrent 1.2.14

wget https://github.com/userdocs/qbittorrent-nox-static/releases/download/release-4.3.6_v1.2.14/x86_64-qbittorrent-nox

chmod +x x86_64-qbittorrent-nox

// 启动qbittorrent
./x86_64-qbittorrent-nox -d

// 关闭qbittorrent
killall x86_64-qbittorrent-nox

ARM - 版本:qbittorrent 4.3.9 libtorrent 2.0.4

wget https://github.com/userdocs/qbittorrent-nox-static/releases/download/release-4.3.9_v2.0.4/armhf-qbittorrent-nox

chmod +x armhf-qbittorrent-nox

// 启动qbittorrent
./armhf-qbittorrent-nox -d

// 关闭qbittorrent
killall armhf-qbittorrent-nox

ARM - 版本:qbittorrent 4.3.9 libtorrent 1.2.14

wget https://github.com/userdocs/qbittorrent-nox-static/releases/download/release-4.3.9_v1.2.14/armhf-qbittorrent-nox

chmod +x armhf-qbittorrent-nox

// 启动qbittorrent
./armhf-qbittorrent-nox -d

// 关闭qbittorrent
killall armhf-qbittorrent-nox

Ubuntu 安装

支持:Ubuntu

## 安装add-apt-repository命令
sudo apt-get update && sudo apt-get install software-properties-common -y

## 添加qbittorrent-nox的PPA软件源
# qBittorrent 稳定版
sudo add-apt-repository ppa:qbittorrent-team/qbittorrent-stable
# qBittorrent 测试版
sudo add-apt-repository ppa:qbittorrent-team/qbittorrent-unstable

## 安装qbittorrent-nox
sudo apt-get install qbittorrent-nox -y

设置开机启动

vi /etc/systemd/system/qbittorrent-nox.service

写入以下代码:

[Unit]
Description=qBittorrent-nox
After=network.target
[Service]
User=root
Type=forking
RemainAfterExit=yes
ExecStart=/usr/bin/qbittorrent-nox -d
[Install]
WantedBy=multi-user.target

操作命令

说明命令
启动sudo systemctl start qbittorrent-nox
停止sudo systemctl stop qbittorrent-nox
状态sudo systemctl status qbittorrent-nox
卸载sudo apt autoremove qbittorrent-nox -y
重载配置sudo systemctl daemon-reload
开机启动sudo systemctl enable qbittorrent-nox

其它
Ubuntu 20.04如果出现配置问题,可以将Type=forking修改为Type=simple即可;
qbittorrent后台进程查询ps -aux|grep qbittorrent-nox

Flexget

说明:安装Flexget的两种方式,脚本安装和手动安装,自选其一即可;

脚本安装

# 安装脚本
bash <(wget -qO- https://github.com/Aniverse/inexistence/raw/master/00.Installation/package/flexget/install)

# 配置脚本(自行设定后面的用户,密码,端口,然后粘贴运行即可)
bash <(wget -qO- https://github.com/Aniverse/inexistence/raw/master/00.Installation/package/flexget/configure) -u 用户 -p 密码 -w 端口
  • 脚本安装的Flexget使用普通用户操作,不使用root用户运行,操作的时候切换到普通用户即可;
  • 普通用户既是刚才配置脚本时自行设定的用户如果系统提示没有此用户,按下面的方式新建用户
# 说明:将命令中的sunpma用户替换成自行设定的用户

# 创建用户
useradd sunpma
# 设置密码
passwd sunpma
# 创建用户文件
mkdir /home/sunpma
# 切换用户
su sunpma

手动安装

  • 安装Flexget需要先安装python3pip3
  • 使用python3 -V命令查看是否有安装python3如果服务器有安装就跳过直接安装pip3即可;
  • 手动安装也挺方便,但配置Flexget对新手而言容易出错,没特殊需求建议使用脚本安装;

安装python3

apt-get update && apt-get install python3

安装pip3

  • 使用pip3 -V命令查看是否有安装pip3如果服务器有安装就跳过直接安装FlexGet即可;
apt-get update && apt-get install python3-pip

安装FlexGet

# 安装
pip3 install flexget
# 创建配置目录
mkdir /root/.flexget
# 创建并编辑配置文件
vi /root/.flexget/config.yml

说明:配置文件config.yml最好是本地创建好后上传到服务器,在SSH复制粘贴大概率会出错,本地也不要用TXT进行编辑,会导致编码不正确;

FlexGet示例配置 | 展开查看

templates:
# 剩余空间模板,当path对应的路径的剩余空间小于space规定的数值的时候停止RSS下载
  freespace:
    free_space:
      path: /home/sunpma
      space: 10240
# 下载模板
  qb:
    qbittorrent:
      path: /home/sunpma/download/
      host: localhost
      port: 2017
      username: sunpma
      password: sunpma
  tr:
    transmission:
      path: /home/sunpma/download/
      host: localhost
      port: 9099
      username: sunpma
      password: sunpma
  de:
    deluge:
      path: /home/sunpma/download/
      host: localhost
      port: 58846
      username: sunpma
      password: sunpma
# 体积过滤模板,min 是符合条件的最小种子体积,max 是符合条件的最大种子体积,单位均为 MB
# strict是表示在无法确定大小的情况下是否下载
  size:
    content_size:
      min: 6000
      max: 666666
      strict: no

# 任务模板
tasks:
# Web-HDSky 是任务名称,基本上随便起
  Web-HDSky:
  # RSS 链接请自己修改成你实际的链接
    rss: https://sunpma.com

# 限速模板
#    deluge:
#      max_up_speed: 12288.0
#    qbittorrent
#      maxupspeed: 12288

# 筛选模板
# 正则表达式;标题带OneHD的种子下载,带MTeamPAD的不下载
    regexp:
      accept:
        - OneHD
      reject:
        - MTeamPAD

# WebUI设定
web_server:
  port: 6566
  web_ui: yes
# base_url: /flexget
# base_url 是为了反代设置的,需要使用反代的话就取消这个的注释

# 默认关闭schedules功能,使用cron进行RSS
schedules: no

Flexget操作命令

命令说明
flexget -V查看Flexget版本
flexget check检查config.yml配置文件是否有格式错误
flexget execute正式RSS一次
flexget execute --learn正式RSS一次,但不下载种子,仅标记为已下载
flexget web passwd要设置的密码
flexget daemon start --daemonize开启 Webui 后台运行
which flexget查看flexget位置
crontab -e配置自动订阅
flexget status检查RSS订阅情况
flexget daemon reload-config修改配置文件后执行重新加载
su sunpma切换用户

qbittorrent设置说明

在网上看到的一篇对qbittorrent设置的详细解释,可供参考;
http://blog.sina.com.cn/s/blog_65637f130102zbno.html







发表评论

11 条评论

  1. sunsum

    请问树莓派安装已编译arm版本qbit之后cpu占用一直很高是什么原因呢

  2. 哈哈

    大佬,甲骨文服务器可以下载bt吗?

  3. 演奏

    支持什么系统呢 debian9 还是 ubuntu 16 18 20
    debian9 全新系统 安装失败

  4. Fengguo

    之前那个pt脚本怎么配置啊,没显示网址和端口不知道咋用啊,系统是Ubuntu18

  5. hoiston

    大佬,求教Flexget安装后,怎么可以设定文件夹用户权限?目前遇到问题在DATA文件夹下分类几个文件例如/data/mt,订阅配置里下载路径填写/data就可以但填写/data/mt,总是写入失败.

    1. sunpma
      @hoiston

      修改用户组试试,我一般都是root用户,不存在这问题~
      修改用户组
      -R命令为递归,含里面的子目录和全部文件
      chown sunpma:sunpma /home/sunpma/Aria2
      chown -R sunpma:sunpma /home/sunpma/Aria2

      1. hoiston
        @sunpma

        收到谢谢

  6. cxk

    大佬 通过源安装的版本是3.3.7 怎么安装最新版呢

    1. sunpma
      @cxk

      这个安装的是最新的稳定版本,如果要指定版本需要编译安装

  7. 瞭月

    大佬。。。。

  8. CX

    回头试试