MYF

使用VPS挂PT

VPS上大把大把的流量用不完怎么办?安装一个Transmission挂个PT吧。

背景

在Vultr的服务器上,系统版本为CentOS7,需要开启IPv6。

顺便附上我的推广链接

安装方法

安装Transmission

1
sudo yum install -y transmission transmission-cli transmission-daemon

生成配置文件

这个地方需要先执行一下才能自动生成配置文件。使用如下命令即可启动:

1
sudo service transmission-daemon start

完成后生成的配置文件位于/var/lib/transmission/.config/transmission-daemon/settings.json

这里要说一下,我写这篇文章的时候Transmission的版本为2.92,版本不同,配置文件的路径也有可能会有变化,可以使用rpm -ql transmission-daemon指令查找Transmission的安装位置,比如我现在的安装位置是/var/lib/transmission

修改配置文件

修改配置文件必须要关闭Transmission,命令为:

1
sudo service transmission-daemon stop

然后将内容修改为如下内容,详细的修改信息请参考VPS怎么挂PT?_纳兰斯坦爱因容若的回答,使用我的配置文件的话只需要在「你的用户名」和「你的密码」处修改为自己需要的即可,或者干脆暴力一点,不使用验证,直接访问,把rpc-authentication-required的值修改为false。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
{
"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",
"bind-address-ipv6": "::",
"blocklist-enabled": false,
"blocklist-url": "http://www.example.com/blocklist",
"cache-size-mb": 4,
"dht-enabled": false,
"download-dir": "/var/lib/transmission/Downloads",
"download-queue-enabled": true,
"download-queue-size": 50,
"encryption": 1,
"idle-seeding-limit": 30,
"idle-seeding-limit-enabled": false,
"incomplete-dir": "/var/lib/transmission/Downloads",
"incomplete-dir-enabled": false,
"lpd-enabled": false,
"message-level": 1,
"peer-congestion-algorithm": "",
"peer-id-ttl-hours": 6,
"peer-limit-global": 960,
"peer-limit-per-torrent": 120,
"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": false,
"port-forwarding-enabled": true,
"preallocation": 1,
"prefetch-enabled": true,
"queue-stalled-enabled": true,
"queue-stalled-minutes": 30,
"ratio-limit": 2,
"ratio-limit-enabled": false,
"rename-partial-files": true,
"rpc-authentication-required": false,
"rpc-bind-address": "0.0.0.0",
"rpc-enabled": true,
"rpc-password": "「你的密码」",
"rpc-port": 9091,
"rpc-url": "/transmission/",
"rpc-username": "「你的用户名」",
"rpc-whitelist": "127.0.0.1",
"rpc-whitelist-enabled": false,
"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,否则会提示Permission Denied.,示例如下

1
sudo chown transmission:transmission /mnt/blockstorage/

开放对应端口

在我上面的配置文件中,Transmission的访问界面端口为9091,Trasmission所需要的的端口从49152到65536,对应的属性名称为peer-port-random-highpeer-port-random-low,在DigitalOcean的服务器中,防火墙默认是不开启的,在Vultr中,防火墙默认全部开启,所以我们要把这些端口的防火墙打开。

1
2
3
4
5
firewall-cmd --permanent --zone=public --add-port=9091/tcp
firewall-cmd --permanent --zone=public --add-port=9091/udp
firewall-cmd --permanent --zone=public --add-port=49152-65535/tcp
firewall-cmd --permanent --zone=public --add-port=49152-65535/udp
firewall-cmd --reload

启动Transmission

1
sudo service transmission-daemon start

加入开机启动

1
2
echo "sudo service transmission-daemon start" >> /etc/rc.local
chmod +x /etc/rc.d/rc.local

使用说明

访问{你的ip}:9091登录即可使用Transmission,某邮人PT亲测成功

参考链接