Ubuntu 安装 Qbittorrent

根据官网的描述:
The stable PPA supports Ubuntu 16.04 LTS (only the libtorrent-rasterbar package), 18.04 LTS, 18.10, 19.10 and 20.04 LTS.
请先确保使用的版本为以上之一

简单的写了一个适合 Ubuntu 的一键脚本

bash <(curl -L https://raw.githubusercontent.com/LAOZTK/qb/main/qbt-ubuntu)

先添加PPA源

# qBittorrent Stable(稳定版本)
sudo add-apt-repository ppa:qbittorrent-team/qbittorrent-stable
# or qBittorrent Unstable(不稳定版本)
sudo add-apt-repository ppa:qbittorrent-team/qbittorrent-unstable

然后更新软件包后直接安装

sudo apt-get update && sudo apt-get install qbittorrent

但是在服务器上默认是没有UI的,所以还需要安装 Web UI

sudo apt-get install qbittorrent-nox

为了安全考虑可以为 Qb 单独创建一个用户来使用它(可选)

sudo adduser qbtuser
#禁用ssh登录
sudo usermod -s /usr/sbin/nologin qbtuser
#切换用户到 qbtuser
su qbtuser

初始化qBittorrent-nox
qbittorrent-nox
这时可以使用ip登录Web UI了 端口默认是8080
用户名默认是:admin
密码默认是adminadmin
进去后修改基本设置,比如端口,登陆密码,下载路径等等,然后保存,即可完成初始化。
为了方便管理为 qBittorrent 创建 systemd service

sudo vim /etc/systemd/system/qbittorrent.service
#添加如下代码
[Unit]
Description=qBittorrent-nox service
Documentation=man:qbittorrent-nox(1)
Wants=network-online.target
After=network-online.target nss-lookup.target

[Service]
# if you have systemd < 240 (Ubuntu 18.10 and earlier, for example), you probably want to use Type=simple instead
Type=exec
# change user as needed
User=qbtuser
# The -d flag should not be used in this setup
ExecStart=/usr/bin/qbittorrent-nox
# uncomment this for versions of qBittorrent < 4.2.0 to set the maximum number of open files to unlimited
#LimitNOFILE=infinity
# uncomment this to use "Network interface" and/or "Optional IP address to bind to" options
# without this binding will fail and qBittorrent's traffic will go through the default route
# AmbientCapabilities=CAP_NET_RAW

[Install]
WantedBy=multi-user.target
#保存后退出编辑界面
sudo systemctl daemon-reload

启动 sudo systemctl start qbittorrent

查看状态 systemctl status qbittorrent

停止服务 sudo systemctl stop qbittorrent

开机启动 sudo systemctl enable qbittorrent

禁止开机启动 sudo systemctl disable qbittorrent

注意事项:

  1. 下载目录一定要在服务器上是存在的,不然会下载失败,也会无法显示剩余空间
  2. 如果是使用的非 root 用户安装,设置的下载目录用户一定要有权限读写,不然也会导致下载失败
  3. 使用docker安装Qbittorrent上传速度总是无法跑满,不知道是docker的属性导致的,还是容器没有选择好,刷PT的话尽量使用传统方式安装。

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注