transmission安装及配置-禁用IPv4方法(CentOS6环境)

0) 安装前准备
    #sudo yum install openssl-devel libcurl-devel
    
    //下载libevent2.0压缩包
    #tar xzf libevent-2.0.21-stable.tar.gz  (安装libevent2.0)
    #cd libevent-2.0.21-stable
    #./configure
    #make && sudo make install
    
1) 下载transmission-2.77.tar.xz, 并解压缩, 编译安装。
    #tar xJf transmission-2.77.tar.xz
    #cd transmission-2.77
    
    #export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig/ (如果下面步骤报libevent出错,则添加此行)
    #./configure
    #make
    #sudo make install
    
3) 运行脚本transmission_run.sh启动、停止transmission.
    启动: #/usr/local/bin/transmission-daemon
    停止: #killall transmission-daemon

    配置文件: ~/.config/transmission-daemon/settings.json

    打开浏览器,输入地址: http://localhost:9091 即可打开Web控制台, 并进行下载/管理等工作。


4) 打开防火墙端口51413 (ipv4&ipv6)
    #sudo iptables -I INPUT -p tcp --dport 51413 -j ACCEPT
    #sudo ip6tables -I INPUT -p tcp --dport 51413 -j ACCEPT
    #sudo service iptables save
    #sudo service ip6tables save
    
5) 禁用IPv4:
   一个是防火墙阻止v4的51413端口;"另外一个方法就是在setting.json中设置v4绑定地址为换回地址( 不可行):"

"bind-address-ipv4": "127.0.0.1",

==========================
transmission_run.sh

#!/bin/sh

# All signal's name and number can be found using command: "kill -l"
S_TERM=15   #SIGTERM=15, SIGKILL=9
S_RELOAD=1  #SIGHUP=1

APP_PATH=/usr/local/bin
APP_NAME=transmission-daemon
APP_EXEC=$APP_PATH/$APP_NAME



get_pid()
{
    local program=$1
        local pid=`ps -ef | grep "$program" | grep -v grep | awk  '{print   \$2}'`
    echo $pid
}

start()
{
    #echo "start ......"
    $APP_EXEC
    echo "start finished!"
}

stop()
{
    #echo "stop ......"
    local PID=`get_pid $APP_NAME`
        #echo $APP_NAME\' pid = $PID !
    if [ "$PID" != "" ];then
        kill -s $S_TERM  $PID
    else
        true    
        #echo $APP_NAME not found!
    fi
}

restart()
{
    stop
    start
}

reload()
{
    #echo "reload ......"
        local PID=`get_pid $APP_NAME`
        #echo $APP_NAME\' pid = $PID !
    if [ "$PID" != "" ];then
            kill -s $S_RELOAD  $PID
        echo "reload finished!"
    else
        echo $APP_NAME not found!
    fi
}

case $1 in
    start)
        restart ;;
    stop)
        stop ;;
    restart)
        stop
        start  ;;
    reload)
        reload ;;
    *)
        echo "Usage: $0 start | stop | restart | reload"
esac

-- 添加自动监视目录功能:
在配置文件:~/.config/transmission-daemon/settings.json 中添加如下内容即可:

   "watch-dir": "/home/xxx/Download",
    "watch-dir-enabled": true,




--性能调优:
在/etc/sysctl.conf文件中添加如下内容:

net.core.rmem_max = 4194304
net.core.wmem_max = 1048576



==========
日志写入会影响性能,可以设置日志为/dev/null:
.../transmission-daemon -e /dev/null
或者仅仅写入错误日志:
.../transmission-daemon --log-error


--
配置文件解读:
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
"alt-speed-up" : 500, #计划时段上传限速值
"alt-speed-down" : 500, #计划时段下载限速值
"alt-speed-enabled" : false ,
"alt-speed-time-begin" : 540,
"alt-speed-time-day" : 127,
"alt-speed-time-enabled" : true , #启用计划工作,为false时,以上计划配置则不生效
"alt-speed-time-end" : 420, #计划结束时间,为零点到开始时间的分钟数,比如7:00就是7*60=420。另外,该时间是用的GMT时间,即北京时间-8小时。比如你计划北京时间7点30分开始,这个数字应该是(7-8+24)*60+30=1410
"bind-address-ipv4" : "0.0.0.0" ,
"bind-address-ipv6" : "::" ,
"blocklist-enabled" : true ,
"blocklist-updates-enabled" : false ,
"blocklist-url" : "<a href=" http: //www .example.com /blocklist ">http://www.example.com/blocklist</a>" ,
"cache-size-mb" : 4, #缓存大小,以MB为单位,建议设大一些,避免频繁读写硬盘而伤硬盘,建议设为内存大小的1/6~1/4
"compact-view" : false ,
"dht-enabled" : false , #关闭DHT(不通过tracker寻找节点)功能,不少PT站的要求,但BT下载设置为true会使得下载更好
"download-dir" : "/home/tengda/Downloads" , #下载的内容存放的目录
"download-queue-enabled" : true ,
"download-queue-size" : 5,
"encryption" : 1, #0=不加密,1=优先加密,2=必须加密
"idle-seeding-limit" : 30,
"idle-seeding-limit-enabled" : false ,
"incomplete-dir" : "/home/tengda/Downloads" ,
"incomplete-dir-enabled" : false ,
"inhibit-desktop-hibernation" : true ,
"lpd-enabled" : false , #禁用LDP(本地节点发现,用于在本地网络寻找节点),不少PT站的要求
"main-window-height" : 500,
"main-window-is-maximized" : 0,
"main-window-width" : 615,
"main-window-x" : 337,
"main-window-y" : 211,
"message-level" : 2,
"open-dialog-dir" : "/home/tengda/\u684c\u9762" ,
"peer-congestion-algorithm" : "" ,
"peer-limit-global" : 240, #全局连接数
"peer-limit-per-torrent" : 60, #每个种子最多的连接数
"peer-port" : 51413, #预设的port口
"peer-port-random-high" : 65535,
"peer-port-random-low" : 49152,
"peer-port-random-on-start" : false , #不建议改为true
"peer-socket-tos" : "default" ,
"pex-enabled" : false , #禁用PEX(节点交换,用于同已与您相连接的节点交换节点名单),不少PT站的要求
"port-forwarding-enabled" : true , #启用uPnP和NAT-PMP端口转发
"preallocation" : 1, #预分配文件磁盘空间,0=关闭,1=快速,2=完全。建议取1开启该功能,防止下载大半了才发现磁盘不够。取2时,可以减少磁盘碎片,但速度较慢。
"prefetch-enabled" : 1,
"queue-stalled-enabled" : true ,
"queue-stalled-minutes" : 30,
"ratio-limit" : 2,
"ratio-limit-enabled" : false ,
"rename-partial-files" : true , #在未完成的文件名后添加后缀.part,false=禁用
"rpc-authentication-required" : true , #远程电脑登陆验证(授权),默认为false,不需用户名和密码就能登陆web-ui
"rpc-bind-address" : "0.0.0.0" ,
"rpc-enabled" : true ,
"rpc-password" : "{c8c083168db9fff40b5136b6d0f3f4a864110a78\/oH51JaE" , #web-ui的密码,可直接修改,重新运行或者reload服务的时候会自动被加密
"rpc-port" : 9091, #默认web-ui的port口,可自行更改
"rpc-url" : "/transmission/" ,
"rpc-username" : "tengda" , #远程电脑登入web-ui的用户名称
"rpc-whitelist" : "127.0.0.1" ,&nbsp; #允许远程连接控制的电脑IP地址白名单,如果只允许局域网内电脑控制的话可以用“192.168.*.* ”
"rpc-whitelist-enabled" : true , #如果你要让其他网段连入,请设false
"scrape-paused-torrents-enabled" : true ,
"script-torrent-done-enabled" : false ,
"script-torrent-done-filename" : "/home/tengda" ,
"seed-queue-enabled" : false ,
"seed-queue-size" : 10,
"show-backup-trackers" : true ,
"show-extra-peer-details" : false ,
"show-filterbar" : true ,
"show-notification-area-icon" : false ,
"show-options-window" : true ,
"show-statusbar" : true ,
"show-toolbar" : true ,
"show-tracker-scrapes" : true ,
"sort-mode" : "sort-by-age" ,
"sort-reversed" : false ,
"speed-limit-down" : 300, #平时的下载限速
"speed-limit-down-enabled" : true , #启用平时下载限速
"speed-limit-up" : 30, #平时上传限速
"speed-limit-up-enabled" : true , #启用平时上传限速
"start-added-torrents" : false ,
"statusbar-stats" : "total-ratio" ,
"torrent-added-notification-enabled" : true ,
"torrent-complete-notification-enabled" : true ,
"torrent-complete-sound-enabled" : true ,
"trash-can-enabled" : true ,
"trash-original-torrent-files" : false ,
"umask" : 18, #默认18,这会让下载回来的文件目录的权限为0755,而改成0可以把权限改成0777,这样就方便了通过局域网电脑对文件目录的全权控制,比如把字幕文件丢到电影目录里
"upload-slots-per-torrent" : 14
"utp-enabled" : true , #启用μTP协议
"watch-dir" : "/home/tengda/\u4e0b\u8f7d" , #transmission监控目录,凡是在这个目录里的种子都会自动下载
"watch-dir-enabled" : false #允许监控目录开关

--

猜你喜欢

转载自blog.csdn.net/mingzhiqing/article/details/51638766