transmission安裝及配置-禁用IPv4方法(CentOS6環境)
阿新 • • 發佈:2019-01-31
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
--
配置檔案解讀:
--
#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 ,
"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" ,
#允許遠端連線控制的電腦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 #允許監控目錄開關
|
--