在Ubuntu下安装Transmission

BobAnkh published on
2 min, 341 words

Categories: Linux

在Linux下(本文以Ubuntu 18.04 LTS为例)安装一个快速简单且免费的BitTorrent客户端Transmission,并启用WebUI。

注意:作为root用户进行工作或在对应命令前加上sudo

1. 安装 transmission-daemon

只需要在你的终端输入以下命令即可完成安装:

sudo apt install transmission-daemon -y

2. 修改 settings.json

首先你需要先停止 transmission-daemon 然后再修改配置文件

配置文件 settings.json 通常会在目录 /etc/transmission/之下

在你的终端中输入以下两行命令来停止transmission-daemon并打开配置文件 settings.json

sudo service transmission-daemon stop
vim /etc/transmission-daemon/settings.json

这里提供了一个配置文件 settings.json可行的示例

其中,备注为check的行需要你进行检查是否与示例一致,备注为modify的行你可以根据自己的情况自行修改:

{
    "alt-speed-down": 50,
    "alt-speed-enabled": false,
    "alt-speed-time-begin": 540,
    "alt-speed-time-day": 127,
    "alt-speed-time-enabled": false,
    "alt-speed-time-end": 1020,
    "alt-speed-up": 50,
    "bind-address-ipv4": "0.0.0.0",  //check
    "bind-address-ipv6": "::", //check
    "blocklist-enabled": false,//check
    "blocklist-url": "http://www.example.com/blocklist",
    "cache-size-mb": 4,
    "dht-enabled": true,
    "download-dir": "/var/lib/transmission-daemon/downloads", //can modify to where you want to put your files
    "download-queue-enabled": true,
    "download-queue-size": 5,
    "encryption": 1,
    "idle-seeding-limit": 30,
    "idle-seeding-limit-enabled": false,
    "incomplete-dir": "/var/lib/transmission-daemon/Downloads", //can modify to where you want to put your files
    "incomplete-dir-enabled": false,
    "lpd-enabled": false,
    "message-level": 1,
    "peer-congestion-algorithm": "",
    "peer-id-ttl-hours": 6,
    "peer-limit-global": 200,
    "peer-limit-per-torrent": 50,
    "peer-port": 51413,
    "peer-port-random-high": 65535,
    "peer-port-random-low": 49152,
    "peer-port-random-on-start": false,
    "peer-socket-tos": "default",
    "pex-enabled": true,
    "port-forwarding-enabled": true,
    "preallocation": 1,
    "prefetch-enabled": 1,
    "queue-stalled-enabled": true,
    "queue-stalled-minutes": 30,
    "ratio-limit": 2,
    "ratio-limit-enabled": false,
    "rename-partial-files": true,
    "rpc-authentication-required": true,//check
    "rpc-bind-address": "0.0.0.0", //check
    "rpc-enabled": true, //check
    "rpc-host-whitelist": "",//check
    "rpc-host-whitelist-enabled": true,//check
    "rpc-password": "passwd",//change to your password
    "rpc-port": 9091,//port to visit from web
    "rpc-url": "/transmission/",//can modify
    "rpc-username": "transmission", //user
    "rpc-whitelist": "*.*.*.*",//modify
    "rpc-whitelist-enabled": true,//check
    "scrape-paused-torrents-enabled": true,
    "script-torrent-done-enabled": false,
    "script-torrent-done-filename": "",
    "seed-queue-enabled": false,
    "seed-queue-size": 10,
    "speed-limit-down": 100,
    "speed-limit-down-enabled": false,
    "speed-limit-up": 100,
    "speed-limit-up-enabled": false,
    "start-added-torrents": true,
    "trash-original-torrent-files": false,
    "umask": 18,
    "upload-slots-per-torrent": 14,
    "utp-enabled": true
}

完成修改后,保存并退出,然后在终端输入以下命令来启动transmission-daemon并检查其状态

sudo service transmission-daemon start
sudo service transmission-daemon status

如果此时没有输出任何warning或者failure,那么说明配置已完成并且可以正常工作了

然后你就可以访问以下地址http://<your ip address>:9091进入到transmission-daemon的WebUI界面进行管理

3. 在配置并启动后你可能会遇到的报错

“UDP Failed to set receive buffer ... ” Error

解决该错误,只需要输入以下两行命令即可解决:

sudo sysctl -w net.core.rmem_max=8388608
sudo sysctl -w net.core.wmem_max=8388608