VPS上用debian装transmission教程 |
1. 前言: 3u0Bu4 http://blog.numino.net/ 原来都是在Centos上装Transmission挂PT的,这两天在折腾我的VPS,分别试着在Centos和Debian上安装了rtorrent+rutorrent,结果发现rtorrent和transmission相比,并不是很稳定,经常崩溃,虽然可以写脚本定时检查重启,但每次重启都会重新hash文件,问题多多,所以个人以为还是transmission比较合适个人安装使用,之所以rtorrent很多seedbox在用,主要是它比较容易支持多用户,适合多人共享。最终决定还是装回transmission,因为reload的OS是debian,所以也不准备换成centos,于是就有了这篇教程。 lwH0K1 http://blog.numino.net/ 2.升级系统 kxn6OJ http://blog.numino.net/ 我这里reload的是debian-5.0x86的,不同的版本有可能出现的错误不一样,有问题可以跟贴问,为了方便,我这里都是用root登录安装的 459t8q http://blog.numino.net/ 首先升级系统:apt-get update 59CieK http://blog.numino.net/ apt-get upgrade wbbFVv http://blog.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 Cxt6N7 http://blog.numino.net/ 复制代码你不能忽略这这个,不然下面安装必要库文件的时候会有些库装不上,要解决这个错误,输入下面命令apt-get install debian-archive-keyring 1a7qn7 http://blog.numino.net/ 复制代码然后重新输入上面两条命令,这次就没有错误了,你需要等几分钟等这个过程结束,这取决于你的VPS m0RUlE http://blog.numino.net/ 3.安装Transmission qX96i6 http://blog.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 8hX17P http://blog.numino.net/ 复制代码下载transmission,我这里下的是2.13,并不是最新版,因为最新的版本不在我常去PT的允许客户端列表里,你安装的时候也可以看看你所混的PT的FAQ,然后下载合适的版本,不然被Ban了不要怪我wget http://download.m0k.org/transmission/files/transmission-2.13.tar.bz2 anxmsK http://blog.numino.net/ tar xvjf transmission-2.13.tar.bz2 rB0Ksw http://blog.numino.net/ cd transmission-2.13 4sIbyw http://blog.numino.net/ ./configure 0wl3gm http://blog.numino.net/ 复制代码在./configure那一步出现错误:configure: error: libevent 1.4.9 or higher not found! x99AS2 http://blog.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 w7ANV0 http://blog.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 ESayk5 http://blog.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 8NVavX http://blog.numino.net/ wget http://ftp.us.debian.org/debian/pool/main/libe/libevent/libevent-dev_1.4.13-stable-1_i386.deb Ehpg8T http://blog.numino.net/ dpkg -i *.deb 7GHoul http://blog.numino.net/ 复制代码然后继续./configure 2z043w http://blog.numino.net/ make 9y39p9 http://blog.numino.net/ make install jCFGw3 http://blog.numino.net/ 复制代码 0LEktx http://blog.numino.net/ 4.安装Transmission的启动,停止脚本 JC38DS http://blog.numino.net/ 脚本在transmission网站有现成的,为了方便起见,我还是把它放在这里 OzcnsC http://blog.numino.net/ #! /bin/sh 1VbG6h http://blog.numino.net/ ### BEGIN INIT INFO V6aXVV http://blog.numino.net/ # Provides: transmission-daemon FW92o3 http://blog.numino.net/ # Required-Start: networking 5nJ43h http://blog.numino.net/ # Required-Stop: networking 8v1wAA http://blog.numino.net/ # Default-Start: 2 3 5 B5sh01 http://blog.numino.net/ # Default-Stop: 0 1 6 JV7Qcf http://blog.numino.net/ # Short-Description: Start the transmission BitTorrent daemon client. eUZiqH http://blog.numino.net/ ### END INIT INFO rGz0El http://blog.numino.net/ # Original Author: Lennart A. JÃŒtte, based on Rob Howell's script P33j8n http://blog.numino.net/ # Modified by Maarten Van Coile & others (on IRC) ei4Fak http://blog.numino.net/ # Do NOT "set -e" i32T8A http://blog.numino.net/ # 4xK5Pg http://blog.numino.net/ # ----- CONFIGURATION ----- y378b4 http://blog.numino.net/ # 6b501l http://blog.numino.net/ # For the default location Transmission uses, visit: gReUee http://blog.numino.net/ # http://trac.transmissionbt.com/wiki/ConfigFiles XI6OPR http://blog.numino.net/ # For a guide on how set the preferences, visit: 0K827m http://blog.numino.net/ # http://trac.transmissionbt.com/wiki/EditConfigFiles lag018 http://blog.numino.net/ # For the available environement variables, visit: 4ks44e http://blog.numino.net/ # http://trac.transmissionbt.com/wiki/EnvironmentVariables 3ksZ4d http://blog.numino.net/ # v5os9J http://blog.numino.net/ # The name of the user that should run Transmission. O183lz http://blog.numino.net/ # It's RECOMENDED to run Transmission in it's own user, bAr7r8 http://blog.numino.net/ # by default, this is set to 'transmission'. 82f29O http://blog.numino.net/ # For the sake of security you shouldn't set a password 12Gm4B http://blog.numino.net/ # on this user a4GicA http://blog.numino.net/ USERNAME=transmission 0M32t3 http://blog.numino.net/ # ----- *ADVANCED* CONFIGURATION ----- A6jww2 http://blog.numino.net/ # Only change these options if you know what you are doing! 2CaZeo http://blog.numino.net/ # EXtvX0 http://blog.numino.net/ # The folder where Transmission stores the config & web files. FBqimM http://blog.numino.net/ # ONLY change this you have it at a non-default location I1MMX5 http://blog.numino.net/ #TRANSMISSION_HOME="/var/config/transmission-daemon" ClzpRb http://blog.numino.net/ #TRANSMISSION_WEB_HOME="/usr/share/transmission/web" 8LygCr http://blog.numino.net/ # mQl6jk http://blog.numino.net/ # The arguments passed on to transmission-daemon. 7uK4ij http://blog.numino.net/ # ONLY change this you need to, otherwise use the HEpSmT http://blog.numino.net/ # settings file as per above. wnE9pS http://blog.numino.net/ #TRANSMISSION_ARGS="" ThuyRZ http://blog.numino.net/ # ----- END OF CONFIGURATION ----- ifd117 http://blog.numino.net/ # b4hMpN http://blog.numino.net/ # PATH should only include /usr/* if it runs after the mountnfs.sh script. jrUGX6 http://blog.numino.net/ PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin fT7igj http://blog.numino.net/ DESC="bittorrent client" 42uL8Y http://blog.numino.net/ NAME=transmission-daemon YxnPi3 http://blog.numino.net/ DAEMON=$(which $NAME) BCI4W2 http://blog.numino.net/ PIDFILE=/var/run/$NAME.pid Kv67vh http://blog.numino.net/ SCRIPTNAME=/etc/init.d/$NAME iLMp15 http://blog.numino.net/ # Exit if the package is not installed ymR993 http://blog.numino.net/ [ -x "$DAEMON" ] || exit 0 se917g http://blog.numino.net/ # Read configuration variable file if it is present 9Uw2Tp http://blog.numino.net/ [ -r /etc/default/$NAME ] && . /etc/default/$NAME EBO637 http://blog.numino.net/ # Load the VERBOSE setting and other rcS variables eo3tOB http://blog.numino.net/ [ -f /etc/default/rcS ] && . /etc/default/rcS lC5585 http://blog.numino.net/ # WAYFzP http://blog.numino.net/ # Function that starts the daemon/service 8rA4fi http://blog.numino.net/ # ONVrGJ http://blog.numino.net/ do_start() KedMac http://blog.numino.net/ { ysoiDa http://blog.numino.net/ # Export the configuration/web directory, if set 5XDD7c http://blog.numino.net/ if [ -n "$TRANSMISSION_HOME" ]; then S1R1sP http://blog.numino.net/ export TRANSMISSION_HOME r5i27W http://blog.numino.net/ fi 2KxZdl http://blog.numino.net/ if [ -n "$TRANSMISSION_WEB_HOME" ]; then 1VGCBS http://blog.numino.net/ export TRANSMISSION_WEB_HOME 6vaVXN http://blog.numino.net/ fi 19Sq60 http://blog.numino.net/ # Return o5WEhp http://blog.numino.net/ # 0 if daemon has been started 417h1G http://blog.numino.net/ # 1 if daemon was already running 8sDMYF http://blog.numino.net/ # 2 if daemon could not be started 6bCVUM http://blog.numino.net/ start-stop-daemon --chuid $USERNAME --start --pidfile $PIDFILE --make-pidfile \ 4uIL1z http://blog.numino.net/ --exec $DAEMON --background --test -- -f $TRANSMISSION_ARGS > /dev/null \ UQ11yf http://blog.numino.net/ || return 1 I1iudN http://blog.numino.net/ start-stop-daemon --chuid $USERNAME --start --pidfile $PIDFILE --make-pidfile \ S9fv1k http://blog.numino.net/ --exec $DAEMON --background -- -f $TRANSMISSION_ARGS \ hPBh32 http://blog.numino.net/ || return 2 1y5Tw1 http://blog.numino.net/ } 25q1p1 http://blog.numino.net/ # iy5paT http://blog.numino.net/ # Function that stops the daemon/service C6YsZ3 http://blog.numino.net/ # G2Nd4S http://blog.numino.net/ do_stop() J5e4Wt http://blog.numino.net/ { 7eVUkk http://blog.numino.net/ # Return X7l3Em http://blog.numino.net/ # 0 if daemon has been stopped I5nn7S http://blog.numino.net/ # 1 if daemon was already stopped n2dL6L http://blog.numino.net/ # 2 if daemon could not be stopped Nx0aAo http://blog.numino.net/ # other if a failure occurred l6t3Y7 http://blog.numino.net/ start-stop-daemon --stop --quiet --retry=TERM/10/KILL/5 --pidfile $PIDFILE --name $NAME dMN15T http://blog.numino.net/ RETVAL="$?" rP763x http://blog.numino.net/ [ "$RETVAL" = 2 ] && return 2 uYOO7Z http://blog.numino.net/ # Wait for children to finish too if this is a daemon that forks k07zC2 http://blog.numino.net/ # and if the daemon is only ever run from this initscript. 9OrgdI http://blog.numino.net/ # If the above conditions are not satisfied then add some other code 5foquf http://blog.numino.net/ # that waits for the process to drop all resources that could be n6zddP http://blog.numino.net/ # needed by services started subsequently. A last resort is to ReSPES http://blog.numino.net/ # sleep for some time. eZDwEf http://blog.numino.net/ start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON 1Yxp91 http://blog.numino.net/ [ "$?" = 2 ] && return 2 5ItNG7 http://blog.numino.net/ # Many daemons don't delete their pidfiles when they exit. 54u98z http://blog.numino.net/ rm -f $PIDFILE 7JdMN2 http://blog.numino.net/ return "$RETVAL" 05UM59 http://blog.numino.net/ } Gvhc03 http://blog.numino.net/ case "$1" in xMfhp6 http://blog.numino.net/ start) 4fD0z1 http://blog.numino.net/ echo "Starting $DESC" "$NAME..." 1bRN27 http://blog.numino.net/ do_start mlK59V http://blog.numino.net/ case "$?" in wXzp5y http://blog.numino.net/ 0|1) echo " Starting $DESC $NAME succeeded" ;; yy4Mey http://blog.numino.net/ *) echo " Starting $DESC $NAME failed" ;; qCMd3W http://blog.numino.net/ esac PVI0Q2 http://blog.numino.net/ ;; KeNG34 http://blog.numino.net/ stop) G50o51 http://blog.numino.net/ echo "Stopping $DESC $NAME..." rQJ209 http://blog.numino.net/ do_stop 77mLLP http://blog.numino.net/ case "$?" in 3w2ZvS http://blog.numino.net/ 0|1) echo " Stopping $DESC $NAME succeeded" ;; WFX5jW http://blog.numino.net/ *) echo " Stopping $DESC $NAME failed" ;; aBr8oj http://blog.numino.net/ esac a8W8jX http://blog.numino.net/ ;; 5q5UXs http://blog.numino.net/ restart|force-reload) OrLOsn http://blog.numino.net/ # llw2rb http://blog.numino.net/ # If the "reload" option is implemented then remove the Dp5tCG http://blog.numino.net/ # 'force-reload' alias x035WI http://blog.numino.net/ # xu2Zag http://blog.numino.net/ echo "Restarting $DESC $NAME..." u35BZP http://blog.numino.net/ do_stop RPCHn3 http://blog.numino.net/ case "$?" in PmnJFg http://blog.numino.net/ 0|1) Q1IfiJ http://blog.numino.net/ do_start jEA87f http://blog.numino.net/ case "$?" in mxOq7n http://blog.numino.net/ 0|1) echo " Restarting $DESC $NAME succeeded" ;; c57J06 http://blog.numino.net/ *) echo " Restarting $DESC $NAME failed: couldn't start $NAME" ;; P21P7d http://blog.numino.net/ esac BQJ1BT http://blog.numino.net/ ;; k6gKMl http://blog.numino.net/ *) 0KDLLx http://blog.numino.net/ echo " Restarting $DESC $NAME failed: couldn't stop $NAME" ;; tLc2Wm http://blog.numino.net/ esac TGOgY4 http://blog.numino.net/ ;; P4f0aF http://blog.numino.net/ *) IsQ4Xx http://blog.numino.net/ echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2 fvLnZc http://blog.numino.net/ exit 3 ae97O2 http://blog.numino.net/ ;; dtKskT http://blog.numino.net/ esac 0Z53v8 http://blog.numino.net/ 复制代码这个脚本文件需要作为transmission-daemon放在/etc/init.d/下面,输入以下命令: 3W5CnP http://blog.numino.net/ vi /etc/init.d/transmission-daemon ytc8A3 http://blog.numino.net/ 复制代码按i,然后把上面这个脚本粘帖进去,按ESC,然后按冒号:,输入wq,按回车,文件就建立好了 zuTQ7C http://blog.numino.net/ 接下来更改文件的权限并使它在启动的时候可以自动执行: x4CHeL http://blog.numino.net/ chmod +x /etc/init.d/transmission-daemon 7p3A1p http://blog.numino.net/ chown root:root /etc/init.d/transmission-daemon zdtKaP http://blog.numino.net/ update-rc.d transmission-daemon defaults Up7xZk http://blog.numino.net/ 复制代码下来新建一个用户运行transmission,这里用的用户名是transmission,当然你也可以用其他的,不过记得要更改脚本了的USERNAME与之对应 OE6Aek http://blog.numino.net/ useradd -mr transmission 290Cf5 http://blog.numino.net/ chmod g+rwx /home/transmission/ Oy13Ph http://blog.numino.net/ 复制代码 2ektQS http://blog.numino.net/ 建立transmission的下载目录并设定权限: Kt62jW http://blog.numino.net/ mkdir -p /home/transmission/Downloads/ A7JY74 http://blog.numino.net/ chown -R transmission.transmission /home/transmission/Downloads/ 8V896H http://blog.numino.net/ chmod g+w /home/transmission/Downloads/ I146Wa http://blog.numino.net/ 复制代码接下来就可以启动transmission了: iYKWo5 http://blog.numino.net/ /etc/init.d/transmission-daemon start O8qESv http://blog.numino.net/ 复制代码 1GeiJv http://blog.numino.net/ transmission启动后就自动会在/home/transmission/.config/transmission-daemon下生成settings.json文件,不过在你更改设置之前必须先停止transmission: TSwAtX http://blog.numino.net/ /etc/init.d/transmission-daemon stop 01ufnO http://blog.numino.net/ 复制代码这样你就可以开始更改设置了: 0wAC91 http://blog.numino.net/ vi /home/transmission/.config/transmission-daemon/settings.json shx4lF http://blog.numino.net/ 复制代码按i以后就可以开始编辑了,至于参数什么意思请参考transmission的网站,改完后按ESC, 按冒号:,输入wq回车存盘 6gVe7G http://blog.numino.net/ 为了方便你在家里的电脑上用Transmission Remote GUI的连上去管理,下面的设置你必须更改: Qo7QF9 http://blog.numino.net/ "rpc-whitelist-enabled": false - 默认是true,要改为false vDG87q http://blog.numino.net/ “rpc-password": "密码", TPb4LX http://blog.numino.net/ "rpc-username": "用户名", 80qGnf http://blog.numino.net/ 上面的密码和用户名你可以自己指定 yPHu8q http://blog.numino.net/ 复制代码 o3YVJZ http://blog.numino.net/ 从新启动transmission,新的设置就会生效: cTex25 http://blog.numino.net/ /etc/init.d/transmission-daemon start BlHgqj http://blog.numino.net/ 复制代码现在你可以下载并安装Transmission Remote GUI,在GUI的options输入VPS的IP地址,rpc的端口(默认是9091,你可以在settings.json中改成其他的),你的用户名和密码,就可以连到你VPS上的transmission了 vVOX5h http://blog.numino.net/ Transmission Remote GUI的下载地址: r1dQQ6 http://blog.numino.net/ http://transmisson-remote-gui.googlecode.com/files/transgui-2.2-setup.exe HLOG20 http://blog.numino.net/ 复制代码另外如果你用Android的手机,可以在菜市场搜索安装Transdroid,它可以很方便的在手机上管理transmission,也可以在手机上下载torrent,通过它传到vps的transmission里进行下载,非常方便 MP2Vhq http://blog.numino.net/ 至此transmission在debian的安装就告一段落了,下来有时间我会写一下如何通过rss和irc自动下载torrent并传给transmission进行下载
|
|