在CentOS 上安装Transmission挂PT
时间:2016-03-18 00:50 来源:linux.it.net.cn 作者:IT
1. 首先安装基本套件
yum -y install gcc gcc-c++ m4 make automake libtool gettext openssl-devel pkgconfig perl-libwww-perl perl-XML-Parser curl curl-devel libevent-devel libevent libidn-devel zlib-devel which
如果没有安装rpmforge的话还需手动安装perl-XML-Parser:
32位 rpm -ihv http://acelnmp.googlecode.com/files/perl-XML-Parser-2.36-1.el5.rf.i386.rpm 64位 rpm -ihv http://acelnmp.googlecode.com/files/perl-XML-Parser-2.36-1.el5.rf.x86_64.rpm下载套件
1 cd /usr/src
2 wget http://ftp.gnome.org/pub/gnome/sources/intltool/0.40/intltool-0.40.6.tar.gz
3 wget http://ftp.gnu.org/gnu/libiconv/libiconv-1.13.1.tar.gz
4 wget http://download.m0k.org/transmission/files/transmission-2.13.tar.bz2
按照顺序安装:
01 tar zxf intltool-*.tar.gz
02 cd intltool-*
03 ./configure --prefix=/usr
04 make -s
05 make -s install
06 cd ..
07 rm -rf intltool-*
08
09 tar zxf libiconv-1.13.1.tar.gz
10 cd libiconv-1.13.1
11 ./configure --prefix=/usr/local/libiconv
12 make && make install
13 cd ..
14 rm -fr libiconv-*
15 echo "/usr/local/lib" >> /etc/ld.so.conf
16 /sbin/ldconfig
17
18 tar xjf transmission-*.tar.bz2
19 cd transmission-*
20 ./configure --prefix=/usr
21 make -s
22 make -s install
23 cd ..
24 rm -rf transmission-*
2. 建立Transmission所对应的用户(密码输入两次)(本例中密码transmission)
1 useradd transmission
2 passwd transmission
3. 建立 Transmission 的设置目录及下载目录
1 mkdir -p /usr/local/transmission/
2 mkdir -p /web/www/transmission/incomplete/
3 chown -R transmission:transmission /web/www/transmission/
4 chmod 777 /web/www/transmission/
4. 运行Transmission以生产Transmission的配置 (此步驟要执行两次)
1 /usr/bin/transmission-daemon -g /usr/local/transmission
2 killall transmission-daemon
5. 修改Transmission的配置文件
1 cp /usr/local/transmission/settings.json /usr/local/transmission/settings.json.bak
2 vi /usr/local/transmission/settings.json
配置文件设定可以参考官方Wiki的说明。例如:
01 "download-dir": "/web/www/transmission",, // 下载完成储存的位置
02 "incomplete-dir": "/web/www/transmission/incomplete",, // 尚未下载完成储存的位置
03 "blocklist-enabled": true, // 启用黑名单
04 "dht-enabled": true, // 启用DHT支援
05 "encryption": 1, // 传输加密
06 "open-file-limit": 64, // 最大开启档案数量
07 "peer-limit-global": 240, // 最大连接数
08 "peer-limit-per-torrent": 60, // 单一任务连接数
09 "peer-port": 51234, // Transmission连接使用的port
10 "ratio-limit": 2.0000, // 上下传比例达到多少停止做种
11 "ratio-limit-enabled": false, // 启用上下传比例
12 "rpc-enabled": true, // 启用网页管理模块
13 "rpc-bind-address": "0.0.0.0", // 指定IP位置
14 "rpc-port": 9091, // 指定网页管理模块的port
15 "rpc-authentication-required": true, // 启用使用者认证方式
16 "rpc-username": "useruseruser", // 登入的使用者名称
17 "rpc-password": "passpassme", // 登入的用户密码
18 "rpc-whitelist-enabled": false, // 启用IP认证模式,这个模式是认IP的唷! 有安全需要再启动
19 "rpc-whitelist": "127.0.0.1,其他可以连的IP", // 指定认可的IP位置,以,区隔
20 "speed-limit-down": 100, // 限制下载速度,以KB/Sec计算
21 "speed-limit-down-enabled": false, // 启用限制下载速度
22 "speed-limit-up": 100, // 限制上传速度,以KB/Sec计算
23 "speed-limit-up-enabled": false, // 启用限制上传速度
24 "upload-slots-per-torrent": 30 // 每个Torrent的上传连接数量
6. 最后在编辑一下iptables规则,加入Transmission使用的端口
1 /etc/init.d/iptables stop
2 iptables -A INPUT -p tcp --dport 9091 -j ACCEPT
3 iptables -A INPUT -p tcp --dport 51234:61000 -j ACCEPT
4 //51234是上面设置的peer-port
5 /etc/init.d/iptables save
6 /etc/init.d/iptables restart
7. 全部搞定,然后新增一个Transmission启动脚本,内容如下
1 vi /etc/init.d/transmission
01 #!/bin/bash
02 #
03 # chkconfig: - 16 84
04 # description: Start up transmission-daemon
05 #
06 # processname: transmission-daemon
07 # config: /etc/sysconfig/transmission
08 # source function library
09 . /etc/rc.d/init.d/functions
10 # Get network config
11 . /etc/sysconfig/network
12 ["${NETWORKING}" = "no" ] && exit 0
13 # Defaults
14 TRANSMISSION_HOME=/usr/bin/transmission-daemon
15 DAEMON_USER="transmission"
16 DAEMON_ARGS="-g /usr/local/transmission"
17 # Daemon
18 NAME=transmission-daemon
19 DAEMON=$(which $NAME)
20 DAEMON_PIDFILE=/var/run/$NAME.pid
21 DAEMON_LOCKFILE=/var/lock/subsys/$NAME
22 DAEMON_SCRIPTNAME=/etc/init.d/$NAME
23 DAEMON_LOGFILE=/var/log/$NAME.log
24 [-x "$DAEMON" ] || exit 0
25 start() {
26 echo -n $"Starting ${NAME}: "
27 if [-n "$TRANSMISSION_HOME" ]; then
28 export TRANSMISSION_HOME
29 fi
30 su - $DAEMON_USER -c "$DAEMON $DAEMON_ARGS"
31 sleep 2
32 status $NAME &> /dev/null && echo_success || echo_failure
33 RETVAL=$?
34 if [$RETVAL -eq 0 ]; then
35 touch $DAEMON_LOCKFILE
36 pidof -o %PPID -x $NAME > $DAEMON_PIDFILE
37 fi
38 echo
39 }
40 stop() {
41 echo -n $"Shutting down ${NAME}: "
42 killproc $NAME
43 RETVAL=$?
44 [$RETVAL -eq 0 ] && /bin/rm -f $DAEMON_LOCKFILE $DAEMON_PIDFILE
45 echo
46 }
47 case "$1" in
48 start)
49 start
50 ;;
51 stop)
52 stop
53 ;;
54 restart)
55 stop
56 start
57 ;;
58 status)
59 status $NAME
60 ;;
61 *)
62 echo "Usage: $SCRIPTNAME {start|stop|restart|status}" >&2
63 exit 3
64 ;;
65 esac
8.然后设置权限,启动之后打开浏览器输入http://IP或域名:9091/就能远控Transmission了。
1 chmod +x /etc/init.d/transmission
2 chkconfig --level 345 transmission on
3 chown -R transmission:transmission /usr/local/transmission/
4 service transmission start
(责任编辑:IT)
1. 首先安装基本套件 yum -y install gcc gcc-c++ m4 make automake libtool gettext openssl-devel pkgconfig perl-libwww-perl perl-XML-Parser curl curl-devel libevent-devel libevent libidn-devel zlib-devel which 如果没有安装rpmforge的话还需手动安装perl-XML-Parser: 32位 rpm -ihv http://acelnmp.googlecode.com/files/perl-XML-Parser-2.36-1.el5.rf.i386.rpm 64位 rpm -ihv http://acelnmp.googlecode.com/files/perl-XML-Parser-2.36-1.el5.rf.x86_64.rpm下载套件 1 cd /usr/src 2 wget http://ftp.gnome.org/pub/gnome/sources/intltool/0.40/intltool-0.40.6.tar.gz 3 wget http://ftp.gnu.org/gnu/libiconv/libiconv-1.13.1.tar.gz 4 wget http://download.m0k.org/transmission/files/transmission-2.13.tar.bz2 按照顺序安装: 01 tar zxf intltool-*.tar.gz 02 cd intltool-* 03 ./configure --prefix=/usr 04 make -s 05 make -s install 06 cd .. 07 rm -rf intltool-* 08 09 tar zxf libiconv-1.13.1.tar.gz 10 cd libiconv-1.13.1 11 ./configure --prefix=/usr/local/libiconv 12 make && make install 13 cd .. 14 rm -fr libiconv-* 15 echo "/usr/local/lib" >> /etc/ld.so.conf 16 /sbin/ldconfig 17 18 tar xjf transmission-*.tar.bz2 19 cd transmission-* 20 ./configure --prefix=/usr 21 make -s 22 make -s install 23 cd .. 24 rm -rf transmission-* 2. 建立Transmission所对应的用户(密码输入两次)(本例中密码transmission) 1 useradd transmission 2 passwd transmission 3. 建立 Transmission 的设置目录及下载目录 1 mkdir -p /usr/local/transmission/ 2 mkdir -p /web/www/transmission/incomplete/ 3 chown -R transmission:transmission /web/www/transmission/ 4 chmod 777 /web/www/transmission/ 4. 运行Transmission以生产Transmission的配置 (此步驟要执行两次) 1 /usr/bin/transmission-daemon -g /usr/local/transmission 2 killall transmission-daemon 5. 修改Transmission的配置文件 1 cp /usr/local/transmission/settings.json /usr/local/transmission/settings.json.bak 2 vi /usr/local/transmission/settings.json 配置文件设定可以参考官方Wiki的说明。例如: 01 "download-dir": "/web/www/transmission",, // 下载完成储存的位置 02 "incomplete-dir": "/web/www/transmission/incomplete",, // 尚未下载完成储存的位置 03 "blocklist-enabled": true, // 启用黑名单 04 "dht-enabled": true, // 启用DHT支援 05 "encryption": 1, // 传输加密 06 "open-file-limit": 64, // 最大开启档案数量 07 "peer-limit-global": 240, // 最大连接数 08 "peer-limit-per-torrent": 60, // 单一任务连接数 09 "peer-port": 51234, // Transmission连接使用的port 10 "ratio-limit": 2.0000, // 上下传比例达到多少停止做种 11 "ratio-limit-enabled": false, // 启用上下传比例 12 "rpc-enabled": true, // 启用网页管理模块 13 "rpc-bind-address": "0.0.0.0", // 指定IP位置 14 "rpc-port": 9091, // 指定网页管理模块的port 15 "rpc-authentication-required": true, // 启用使用者认证方式 16 "rpc-username": "useruseruser", // 登入的使用者名称 17 "rpc-password": "passpassme", // 登入的用户密码 18 "rpc-whitelist-enabled": false, // 启用IP认证模式,这个模式是认IP的唷! 有安全需要再启动 19 "rpc-whitelist": "127.0.0.1,其他可以连的IP", // 指定认可的IP位置,以,区隔 20 "speed-limit-down": 100, // 限制下载速度,以KB/Sec计算 21 "speed-limit-down-enabled": false, // 启用限制下载速度 22 "speed-limit-up": 100, // 限制上传速度,以KB/Sec计算 23 "speed-limit-up-enabled": false, // 启用限制上传速度 24 "upload-slots-per-torrent": 30 // 每个Torrent的上传连接数量 6. 最后在编辑一下iptables规则,加入Transmission使用的端口 1 /etc/init.d/iptables stop 2 iptables -A INPUT -p tcp --dport 9091 -j ACCEPT 3 iptables -A INPUT -p tcp --dport 51234:61000 -j ACCEPT 4 //51234是上面设置的peer-port 5 /etc/init.d/iptables save 6 /etc/init.d/iptables restart 7. 全部搞定,然后新增一个Transmission启动脚本,内容如下 1 vi /etc/init.d/transmission 01 #!/bin/bash 02 # 03 # chkconfig: - 16 84 04 # description: Start up transmission-daemon 05 # 06 # processname: transmission-daemon 07 # config: /etc/sysconfig/transmission 08 # source function library 09 . /etc/rc.d/init.d/functions 10 # Get network config 11 . /etc/sysconfig/network 12 ["${NETWORKING}" = "no" ] && exit 0 13 # Defaults 14 TRANSMISSION_HOME=/usr/bin/transmission-daemon 15 DAEMON_USER="transmission" 16 DAEMON_ARGS="-g /usr/local/transmission" 17 # Daemon 18 NAME=transmission-daemon 19 DAEMON=$(which $NAME) 20 DAEMON_PIDFILE=/var/run/$NAME.pid 21 DAEMON_LOCKFILE=/var/lock/subsys/$NAME 22 DAEMON_SCRIPTNAME=/etc/init.d/$NAME 23 DAEMON_LOGFILE=/var/log/$NAME.log 24 [-x "$DAEMON" ] || exit 0 25 start() { 26 echo -n $"Starting ${NAME}: " 27 if [-n "$TRANSMISSION_HOME" ]; then 28 export TRANSMISSION_HOME 29 fi 30 su - $DAEMON_USER -c "$DAEMON $DAEMON_ARGS" 31 sleep 2 32 status $NAME &> /dev/null && echo_success || echo_failure 33 RETVAL=$? 34 if [$RETVAL -eq 0 ]; then 35 touch $DAEMON_LOCKFILE 36 pidof -o %PPID -x $NAME > $DAEMON_PIDFILE 37 fi 38 echo 39 } 40 stop() { 41 echo -n $"Shutting down ${NAME}: " 42 killproc $NAME 43 RETVAL=$? 44 [$RETVAL -eq 0 ] && /bin/rm -f $DAEMON_LOCKFILE $DAEMON_PIDFILE 45 echo 46 } 47 case "$1" in 48 start) 49 start 50 ;; 51 stop) 52 stop 53 ;; 54 restart) 55 stop 56 start 57 ;; 58 status) 59 status $NAME 60 ;; 61 *) 62 echo "Usage: $SCRIPTNAME {start|stop|restart|status}" >&2 63 exit 3 64 ;; 65 esac 8.然后设置权限,启动之后打开浏览器输入http://IP或域名:9091/就能远控Transmission了。 1 chmod +x /etc/init.d/transmission 2 chkconfig --level 345 transmission on 3 chown -R transmission:transmission /usr/local/transmission/ 4 service transmission start (责任编辑:IT) |