系统

Debian11_x64

创建配置文件夹

1
mkdir -p ~/.config/qBittorrent && mkdir -p ~/Downloads && mkdir -p ~/bin

写入配置文件,开启WebUI

1
2
3
4
5
6
echo '[LegalNotice]
Accepted=true

[Preferences]
WebUI\Port=8080
General\Locale=zh' > ~/.config/qBittorrent/qBittorrent.conf

这里默认设置WebUI端口为8080

出于安全,强烈建议自行修改为其他端口

若服务商有防火墙,记得在后台放行端口

当然,这里也可以用SSH隧道访问,更加安全

下载编译好的qbittorrent-nox

1
wget -qO ~/bin/qbittorrent-nox https://github.com/userdocs/qbittorrent-nox-static/releases/download/release-4.3.9_v1.2.15/x86_64-qbittorrent-nox && chmod 700 ~/bin/qbittorrent-nox

启动并保持后台运行qbittorrent

1
~/bin/qbittorrent-nox -d

写入service,实现开机自启动

1
2
3
4
5
6
7
8
9
10
11
12
echo '[Unit]
Description=qBittorrent-nox
After=network.target

[Service]
User=root
Type=forking
RemainAfterExit=yes
ExecStart=/root/bin/qbittorrent-nox -d

[Install]
WantedBy=multi-user.target' > /etc/systemd/system/qbittorrent-nox.service

注意:需将ExecStart后面的路径改为当前用户的home目录

我这里用的是root用户,如果使用root用户可以直接照搬上面的代码

使用systemctl启动qbittorrent+添加开机自启

1
2
systemctl restart qbittorrent-nox
systemctl enable qbittorrent-nox