VPS上用debian装transmission教程 |
1. 前言: eI1cLt http://www.numino.net 原来都是在Centos上装Transmission挂PT的,这两天在折腾我的VPS,分别试着在Centos和Debian上安装了rtorrent+rutorrent,结果发现rtorrent和transmission相比,并不是很稳定,经常崩溃,虽然可以写脚本定时检查重启,但每次重启都会重新hash文件,问题多多,所以个人以为还是transmission比较合适个人安装使用,之所以rtorrent很多seedbox在用,主要是它比较容易支持多用户,适合多人共享。最终决定还是装回transmission,因为reload的OS是debian,所以也不准备换成centos,于是就有了这篇教程。 2QLm23 http://www.numino.net 2.升级系统 7wmiB8 http://www.numino.net 我这里reload的是debian-5.0x86的,不同的版本有可能出现的错误不一样,有问题可以跟贴问,为了方便,我这里都是用root登录安装的 rM6cLt http://www.numino.net 首先升级系统:apt-get update b10M1s http://www.numino.net apt-get upgrade 4OIW7r http://www.numino.net 复制代码结果第一条命令就有错误:GPG error: http://ftp.de.debian.org lenny/updates Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY AED4B06F473041FA 1H1aO0 http://www.numino.net 复制代码你不能忽略这这个,不然下面安装必要库文件的时候会有些库装不上,要解决这个错误,输入下面命令apt-get install debian-archive-keyring 6mQM7V http://www.numino.net 复制代码然后重新输入上面两条命令,这次就没有错误了,你需要等几分钟等这个过程结束,这取决于你的VPS FsQBL4 http://www.numino.net 3.安装Transmission 5cGvfg http://www.numino.net 先安装必要的库文件这个可以在transmission的网站找到,所以很简单,直接输入apt-get install build-essential automake make autoconf libtool pkg-config libcurl4-openssl-dev intltool libxml2-dev libgtk2.0-dev libnotify-dev libglib2.0-dev libevent-dev LnwFC1 http://www.numino.net 复制代码下载transmission,我这里下的是2.13,并不是最新版,因为最新的版本不在我常去PT的允许客户端列表里,你安装的时候也可以看看你所混的PT的FAQ,然后下载合适的版本,不然被Ban了不要怪我wget http://download.m0k.org/transmission/files/transmission-2.13.tar.bz2 2uzCEF http://www.numino.net tar xvjf transmission-2.13.tar.bz2 gonX56 http://www.numino.net cd transmission-2.13 46b2S8 http://www.numino.net ./configure BGANrs http://www.numino.net 复制代码在./configure那一步出现错误:configure: error: libevent 1.4.9 or higher not found! 2wh6S7 http://www.numino.net 复制代码因此下载安装所需要的libevent版本:wget http://ftp.us.debian.org/debian/pool/main/libe/libevent/libevent-1.4-2_1.4.13-stable-1_i386.deb qpA8q6 http://www.numino.net wget http://ftp.us.debian.org/debian/pool/main/libe/libevent/libevent-core-1.4-2_1.4.13-stable-1_i386.deb cgg83W http://www.numino.net wget http://ftp.us.debian.org/debian/pool/main/libe/libevent/libevent-extra-1.4-2_1.4.13-stable-1_i386.deb FEB89v http://www.numino.net wget http://ftp.us.debian.org/debian/pool/main/libe/libevent/libevent-dev_1.4.13-stable-1_i386.deb RxUI41 http://www.numino.net dpkg -i *.deb HzrqPO http://www.numino.net 复制代码然后继续./configure 74nALY http://www.numino.net make 1Iuwl6 http://www.numino.net make install 92APFR http://www.numino.net 复制代码 65nf7b http://www.numino.net 4.安装Transmission的启动,停止脚本 lv8259 http://www.numino.net 脚本在transmission网站有现成的,为了方便起见,我还是把它放在这里 3MLZ2n http://www.numino.net #! /bin/sh c5X8S6 http://www.numino.net ### BEGIN INIT INFO 6zp9UB http://www.numino.net # Provides: transmission-daemon McV1lu http://www.numino.net # Required-Start: networking U7F4Xr http://www.numino.net # Required-Stop: networking rcW8T2 http://www.numino.net # Default-Start: 2 3 5 4GkBVC http://www.numino.net # Default-Stop: 0 1 6 9uv7mm http://www.numino.net # Short-Description: Start the transmission BitTorrent daemon client. 8aKVdZ http://www.numino.net ### END INIT INFO O1a3YO http://www.numino.net # Original Author: Lennart A. JÃŒtte, based on Rob Howell's script xCRV6j http://www.numino.net # Modified by Maarten Van Coile & others (on IRC) 5uAd68 http://www.numino.net # Do NOT "set -e" XI0I2W http://www.numino.net # HmNTFt http://www.numino.net # ----- CONFIGURATION ----- Bxyk6v http://www.numino.net # p821ng http://www.numino.net # For the default location Transmission uses, visit: N1YszO http://www.numino.net # http://trac.transmissionbt.com/wiki/ConfigFiles u7nQ6r http://www.numino.net # For a guide on how set the preferences, visit: yXMtqk http://www.numino.net # http://trac.transmissionbt.com/wiki/EditConfigFiles N2yu6U http://www.numino.net # For the available environement variables, visit: jR9tXs http://www.numino.net # http://trac.transmissionbt.com/wiki/EnvironmentVariables r8t1lO http://www.numino.net # Z5Qew9 http://www.numino.net # The name of the user that should run Transmission. D7Ltyj http://www.numino.net # It's RECOMENDED to run Transmission in it's own user, g5LdBL http://www.numino.net # by default, this is set to 'transmission'. 7sc0w2 http://www.numino.net # For the sake of security you shouldn't set a password 8zSjQc http://www.numino.net # on this user Jz1S1V http://www.numino.net USERNAME=transmission 3DG564 http://www.numino.net # ----- *ADVANCED* CONFIGURATION ----- KWD41T http://www.numino.net # Only change these options if you know what you are doing! 6QGwpL http://www.numino.net # Ouh8lC http://www.numino.net # The folder where Transmission stores the config & web files. T073T5 http://www.numino.net # ONLY change this you have it at a non-default location cZwXMs http://www.numino.net #TRANSMISSION_HOME="/var/config/transmission-daemon" iG3B9S http://www.numino.net #TRANSMISSION_WEB_HOME="/usr/share/transmission/web" B33xqP http://www.numino.net # VW206A http://www.numino.net # The arguments passed on to transmission-daemon. 99aI2x http://www.numino.net # ONLY change this you need to, otherwise use the f3xzKl http://www.numino.net # settings file as per above. MHe1T8 http://www.numino.net #TRANSMISSION_ARGS="" bb7XQm http://www.numino.net # ----- END OF CONFIGURATION ----- 8rrGpg http://www.numino.net # ZU6vvC http://www.numino.net # PATH should only include /usr/* if it runs after the mountnfs.sh script. 0xHTQm http://www.numino.net PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin 3DfEbE http://www.numino.net DESC="bittorrent client" ZNbfRT http://www.numino.net NAME=transmission-daemon 69t1bM http://www.numino.net DAEMON=$(which $NAME) T2Duo5 http://www.numino.net PIDFILE=/var/run/$NAME.pid DqfXJT http://www.numino.net SCRIPTNAME=/etc/init.d/$NAME 4av59V http://www.numino.net # Exit if the package is not installed 7WU7c4 http://www.numino.net [ -x "$DAEMON" ] || exit 0 wyZEVi http://www.numino.net # Read configuration variable file if it is present zjZL8X http://www.numino.net [ -r /etc/default/$NAME ] && . /etc/default/$NAME TA2lfR http://www.numino.net # Load the VERBOSE setting and other rcS variables nfCYH1 http://www.numino.net [ -f /etc/default/rcS ] && . /etc/default/rcS 253Y8J http://www.numino.net # UWP0mK http://www.numino.net # Function that starts the daemon/service fFZX43 http://www.numino.net # bT8kfr http://www.numino.net do_start() Th5Di9 http://www.numino.net { D3GzpY http://www.numino.net # Export the configuration/web directory, if set Et4bF9 http://www.numino.net if [ -n "$TRANSMISSION_HOME" ]; then hwsbaL http://www.numino.net export TRANSMISSION_HOME k1JdXe http://www.numino.net fi 9GDcj2 http://www.numino.net if [ -n "$TRANSMISSION_WEB_HOME" ]; then 13t55s http://www.numino.net export TRANSMISSION_WEB_HOME 5X624h http://www.numino.net fi 20jN5C http://www.numino.net # Return 338d95 http://www.numino.net # 0 if daemon has been started F95dw3 http://www.numino.net # 1 if daemon was already running bbyy4D http://www.numino.net # 2 if daemon could not be started 0AIkoS http://www.numino.net start-stop-daemon --chuid $USERNAME --start --pidfile $PIDFILE --make-pidfile \ sbVJ7h http://www.numino.net --exec $DAEMON --background --test -- -f $TRANSMISSION_ARGS > /dev/null \ mFt08z http://www.numino.net || return 1 xuO3rU http://www.numino.net start-stop-daemon --chuid $USERNAME --start --pidfile $PIDFILE --make-pidfile \ kAy84j http://www.numino.net --exec $DAEMON --background -- -f $TRANSMISSION_ARGS \ WJJR39 http://www.numino.net || return 2 bg6B9l http://www.numino.net } 7xoxWI http://www.numino.net # DCaggZ http://www.numino.net # Function that stops the daemon/service v76ekR http://www.numino.net # eyLKFp http://www.numino.net do_stop() k3mA68 http://www.numino.net { 63K66y http://www.numino.net # Return b3b3T7 http://www.numino.net # 0 if daemon has been stopped oGTgV6 http://www.numino.net # 1 if daemon was already stopped rYh920 http://www.numino.net # 2 if daemon could not be stopped 5S7pf0 http://www.numino.net # other if a failure occurred pCR0UM http://www.numino.net start-stop-daemon --stop --quiet --retry=TERM/10/KILL/5 --pidfile $PIDFILE --name $NAME vVVPOO http://www.numino.net RETVAL="$?" 4Q7eNC http://www.numino.net [ "$RETVAL" = 2 ] && return 2 Dv8HTG http://www.numino.net # Wait for children to finish too if this is a daemon that forks FqRE5B http://www.numino.net # and if the daemon is only ever run from this initscript. clr2Qo http://www.numino.net # If the above conditions are not satisfied then add some other code z0oLyJ http://www.numino.net # that waits for the process to drop all resources that could be P45ktg http://www.numino.net # needed by services started subsequently. A last resort is to 0768Oh http://www.numino.net # sleep for some time. wxSRf6 http://www.numino.net start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON LeTNiF http://www.numino.net [ "$?" = 2 ] && return 2 F1x9KY http://www.numino.net # Many daemons don't delete their pidfiles when they exit. yLeTNQ http://www.numino.net rm -f $PIDFILE gwl1X7 http://www.numino.net return "$RETVAL" 062C4t http://www.numino.net } 8Y7xFE http://www.numino.net case "$1" in 3PUJ2p http://www.numino.net start) AEwNdk http://www.numino.net echo "Starting $DESC" "$NAME..." LM14c6 http://www.numino.net do_start 8AE5vg http://www.numino.net case "$?" in jNnsy7 http://www.numino.net 0|1) echo " Starting $DESC $NAME succeeded" ;; B6CC31 http://www.numino.net *) echo " Starting $DESC $NAME failed" ;; ATnN3Z http://www.numino.net esac oGS4Ph http://www.numino.net ;; 4Lt4vx http://www.numino.net stop) aX2j0W http://www.numino.net echo "Stopping $DESC $NAME..." hAPIo3 http://www.numino.net do_stop Ce3kQ3 http://www.numino.net case "$?" in vncQqb http://www.numino.net 0|1) echo " Stopping $DESC $NAME succeeded" ;; 08roKA http://www.numino.net *) echo " Stopping $DESC $NAME failed" ;; 48mQnW http://www.numino.net esac TvbJct http://www.numino.net ;; VRxpg0 http://www.numino.net restart|force-reload) b96UmE http://www.numino.net # m71CP5 http://www.numino.net # If the "reload" option is implemented then remove the kO6Fo1 http://www.numino.net # 'force-reload' alias jr97i5 http://www.numino.net # UjzjF6 http://www.numino.net echo "Restarting $DESC $NAME..." LNJUI2 http://www.numino.net do_stop mIoft9 http://www.numino.net case "$?" in n7YfeT http://www.numino.net 0|1) UD371O http://www.numino.net do_start cr98MX http://www.numino.net case "$?" in ie1rjN http://www.numino.net 0|1) echo " Restarting $DESC $NAME succeeded" ;; XlXO50 http://www.numino.net *) echo " Restarting $DESC $NAME failed: couldn't start $NAME" ;; XiGART http://www.numino.net esac cfxTDC http://www.numino.net ;; 6maRqp http://www.numino.net *) w948d4 http://www.numino.net echo " Restarting $DESC $NAME failed: couldn't stop $NAME" ;; gIG4aV http://www.numino.net esac ok6t9h http://www.numino.net ;; SBpc42 http://www.numino.net *) RnNw6n http://www.numino.net echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2 Qp4Vul http://www.numino.net exit 3 cYYvzh http://www.numino.net ;; K72sU9 http://www.numino.net esac TUJ7P5 http://www.numino.net 复制代码这个脚本文件需要作为transmission-daemon放在/etc/init.d/下面,输入以下命令: OJQ0h1 http://www.numino.net vi /etc/init.d/transmission-daemon p73YYZ http://www.numino.net 复制代码按i,然后把上面这个脚本粘帖进去,按ESC,然后按冒号:,输入wq,按回车,文件就建立好了 6w56i7 http://www.numino.net 接下来更改文件的权限并使它在启动的时候可以自动执行: W2tIMc http://www.numino.net chmod +x /etc/init.d/transmission-daemon G36C72 http://www.numino.net chown root:root /etc/init.d/transmission-daemon xD8XJq http://www.numino.net update-rc.d transmission-daemon defaults MOt0JQ http://www.numino.net 复制代码下来新建一个用户运行transmission,这里用的用户名是transmission,当然你也可以用其他的,不过记得要更改脚本了的USERNAME与之对应 oZYv6H http://www.numino.net useradd -mr transmission 0MnXOF http://www.numino.net chmod g+rwx /home/transmission/ 0HDgwz http://www.numino.net 复制代码 nU0Pre http://www.numino.net 建立transmission的下载目录并设定权限: Hf7iDl http://www.numino.net mkdir -p /home/transmission/Downloads/ yQPECa http://www.numino.net chown -R transmission.transmission /home/transmission/Downloads/ UhHdyl http://www.numino.net chmod g+w /home/transmission/Downloads/ Tk9RS1 http://www.numino.net 复制代码接下来就可以启动transmission了: B90PUW http://www.numino.net /etc/init.d/transmission-daemon start 0BFqdi http://www.numino.net 复制代码 Y63YJz http://www.numino.net transmission启动后就自动会在/home/transmission/.config/transmission-daemon下生成settings.json文件,不过在你更改设置之前必须先停止transmission: U033y2 http://www.numino.net /etc/init.d/transmission-daemon stop KzGow2 http://www.numino.net 复制代码这样你就可以开始更改设置了: jTn8GS http://www.numino.net vi /home/transmission/.config/transmission-daemon/settings.json 30MgaC http://www.numino.net 复制代码按i以后就可以开始编辑了,至于参数什么意思请参考transmission的网站,改完后按ESC, 按冒号:,输入wq回车存盘 LA8fHW http://www.numino.net 为了方便你在家里的电脑上用Transmission Remote GUI的连上去管理,下面的设置你必须更改: vJe9ki http://www.numino.net "rpc-whitelist-enabled": false - 默认是true,要改为false 4wPcRf http://www.numino.net “rpc-password": "密码", 420q8t http://www.numino.net "rpc-username": "用户名", U1Al1o http://www.numino.net 上面的密码和用户名你可以自己指定 ySdce7 http://www.numino.net 复制代码 o7ZOe8 http://www.numino.net 从新启动transmission,新的设置就会生效: r4PBOd http://www.numino.net /etc/init.d/transmission-daemon start 44SQ0c http://www.numino.net 复制代码现在你可以下载并安装Transmission Remote GUI,在GUI的options输入VPS的IP地址,rpc的端口(默认是9091,你可以在settings.json中改成其他的),你的用户名和密码,就可以连到你VPS上的transmission了 9h46dm http://www.numino.net Transmission Remote GUI的下载地址: Xr27fu http://www.numino.net http://transmisson-remote-gui.googlecode.com/files/transgui-2.2-setup.exe sLjlOu http://www.numino.net 复制代码另外如果你用Android的手机,可以在菜市场搜索安装Transdroid,它可以很方便的在手机上管理transmission,也可以在手机上下载torrent,通过它传到vps的transmission里进行下载,非常方便 8mPqK9 http://www.numino.net 至此transmission在debian的安装就告一段落了,下来有时间我会写一下如何通过rss和irc自动下载torrent并传给transmission进行下载
|
|