文件服务器常用的软件安装配置(Ubuntu 20.04) 时间: 2022-03-16 22:26 分类: 运维笔记 # 1. 下载软件 ## 1.1 Deluge ```bash sudo add-apt-repository ppa:deluge-team/stable sudo apt-get update sudo apt-get install deluge ``` ## 1.2 qBt ```bash sudo add-apt-repository ppa:qbittorrent-team/qbittorrent-stable sudo apt-get update sudo apt-get install qbittorent ``` ## 1.3 Transmission ```bash sudo add-apt-repository ppa:transmissionbt/ppa sudo apt update sudo apt install transmission ``` # 2. Deluge配置 ## 2.1 服务及WEBUI安装 无脑 ```bash sudo apt install deluged deluge-web deluge-console ``` ## 2.2 基础配置 ### 2.2.1 配置文件 修改下载位置、修改并记录`入栈`&`WEBUI`&`deamon`端口、启用各种插件 ### 2.2.2 安装ltconfig ltconfig是**手动安装**的插件,在设置的插件页安装并启用,选择High Performance配置 下载地址:https://github.com/ratanakvlun/deluge-ltconfig/releases/tag/v2.0.0 ### 2.2.3 配置后台服务 > 参考官方文档:https://deluge.readthedocs.io/en/latest/how-to/systemd-service.html > 官方文档写的太好了 (1)建立用户 ```bash sudo adduser --system --gecos "Deluge Service" --disabled-password --group --home /var/lib/deluge deluge ``` (2)为其他用户授权访问(加入用户组即可) ```bash sudo adduser deluge ``` (3)deluged服务 ```bash sudo vi /etc/systemd/system/deluged.service ``` ```plain-text [Unit] Description=Deluge Bittorrent Client Daemon Documentation=man:deluged After=network-online.target [Service] Type=simple UMask=007 ExecStart=/usr/bin/deluged -d -l /var/log/deluge/daemon.log -L warning Restart=on-failure # Time to wait before forcefully stopped. TimeoutStopSec=300 [Install] WantedBy=multi-user.target ``` (4)web服务 ```bash sudo vi /etc/systemd/system/deluge-web.service ``` ```plain-text [Unit] Description=Deluge Bittorrent Client Web Interface Documentation=man:deluge-web After=deluged.service Wants=deluged.service [Service] Type=simple UMask=027 ExecStart=/usr/bin/deluge-web -d -l /var/log/deluge/web.log -L warning Restart=on-failure [Install] WantedBy=multi-user.target ``` (5)配置服务的用户 ```bash sudo mkdir /etc/systemd/system/deluged.service.d/ sudo vi /etc/systemd/system/deluged.service.d/user.conf ``` 修改为 ```plain-text # Override service user [Service] User=deluge Group=deluge ``` ```bash sudo mkdir /etc/systemd/system/deluge-web.service.d/ sudo vi /etc/systemd/system/deluge-web.service.d/user.conf ``` 修改为 ```plain-text # Override service user [Service] User=deluge Group=deluge ``` (6)配置日志文件夹 ```bash sudo mkdir -p /var/log/deluge sudo chown -R deluge:deluge /var/log/deluge sudo chmod -R 750 /var/log/deluge ``` (7)润 ```sudo service start deluged sudo service start deluge-web ``` ## 2.4 反代 ```ini location /deluge { proxy_pass http://127.0.0.1:11111/; proxy_set_header X-Deluge-Base "/deluge/"; proxy_redirect off; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_cache off; proxy_buffering off; add_header X-Frame-Options SAMEORIGIN; } ``` ## 2.5 其他配置 WEBUI默认密码`deluge` 需要在`设置`-`界面`处修改 桌面GUI需要修改运行模式为`瘦客户端` # 3. qb ## 3.1 装服务 ```bash sudo apt install qbittorrent-nox ``` ## 3.2 建立用户 加入用户组 ```bash sudo adduser --system --gecos "QBittorent Deamon Service" --disabled-password --group --home /var/lib/qbittorrent qbittorrent sudo adduser qbittorrent ``` ## 3.3 配置服务 ```ini [Unit] Description=qBittorrent Command Line Client After=network-online.target [Service] Type=forking User=qbittorrent Group=qbittorrent UMask=007 ExecStart=/usr/bin/qbittorrent-nox -d --webui-port=15050 Restart=on-failure # Time to wait before forcefully stopped. TimeoutStopSec=300 [Install] WantedBy=multi-user.target ``` 启动 (`service start`显示找不到 只好直接`systemctl`了) ```bash sudo systemctl daemon-reload sudo systemctl start qbittorent-nox ``` ## 3.4 ufw规则 ```bash sudo vi /etc/ufw/applications.d/qbt ``` ```ini [qbt-inbound] title = "qbittorent-nox inbound" description = "qbittorent-nox inbound" ports=55050/tcp|55050/udp ``` ```bash sudo ufw allow qbt-inbound ``` ## 3.5 反代设置 > 官方指南: https://github.com/qbittorrent/qBittorrent/wiki/NGINX-Reverse-Proxy-for-Web-UI > 官方还有个secure参数 是ssl相关 因为走CF了所以暂时不加 ```ini proxy_pass http://127.0.0.1:12345/; proxy_http_version 1.1; proxy_set_header Host 127.0.0.1:12345; proxy_set_header X-Forwarded-Host $http_host; proxy_set_header X-Forwarded-For $remote_addr; ``` ## 3.6 qb设置 > https://web.archive.org/web/20220325080633/https://www.jianshu.com/p/ac70172767ed # 4. TR TR的deamon会自动帮你配置用户和服务,很舒服。 ```bash sudo apt install transmission-deamon ``` ## 4.1 配置 > via https://linuxconfig.org/how-to-set-up-transmission-daemon-on-a-raspberry-pi-and-control-it-via-web-interface 先`stop`掉服务, ```bash sudo service transmission-deamon stop ``` 然后 ```bash sudo vi /etc/transmission-daemon/settings.json ``` 主要修改以下部分: ```json "download-dir": "/home/download" "peer-port": 55555 "rpc-url": "/tr/", "rpc-password": "直接填文本下次运行会自动帮你Hash" "rpc-port": 9091 "rpc-username": "username" ``` 接下来start service就行。 ## 4.2 装能看的UI > https://github.com/ronggang/transmission-web-control/wiki/Linux-Installation-CN ```bash wget https://github.com/ronggang/transmission-web-control/raw/master/release/install-tr-control-cn.sh sudo bash install-tr-control-cn.sh ``` 然后按提示操作 ## 4.3 Nginx反代 ```plain-text location /tr { proxy_read_timeout 300; proxy_pass_header X-Transmission-Session-Id; proxy_set_header X-Forwarded-Host $host; proxy_set_header X-Forwarded-Server $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass http://127.0.0.1:9091/tr; } location /rpc { proxy_pass http://127.0.0.1:9091/tr/rpc; } location /upload { proxy_pass http://127.0.0.1:9091/tr/upload; } ``` ## 4.4 其他补充 nginx这边设定是虾配的。 另外访问的时候最好`/tr/` 以避免`error 409` # 5. 其他 文件权限管理 标签: 无