VPS上用debian装transmission教程 |
1. 前言: s76uJL http://blog.numino.net/ 原来都是在Centos上装Transmission挂PT的,这两天在折腾我的VPS,分别试着在Centos和Debian上安装了rtorrent+rutorrent,结果发现rtorrent和transmission相比,并不是很稳定,经常崩溃,虽然可以写脚本定时检查重启,但每次重启都会重新hash文件,问题多多,所以个人以为还是transmission比较合适个人安装使用,之所以rtorrent很多seedbox在用,主要是它比较容易支持多用户,适合多人共享。最终决定还是装回transmission,因为reload的OS是debian,所以也不准备换成centos,于是就有了这篇教程。 EJLuXg http://blog.numino.net/ 2.升级系统 XrQUf7 http://blog.numino.net/ 我这里reload的是debian-5.0x86的,不同的版本有可能出现的错误不一样,有问题可以跟贴问,为了方便,我这里都是用root登录安装的 cQvPai http://blog.numino.net/ 首先升级系统:apt-get update rVYAbj http://blog.numino.net/ apt-get upgrade itOvvK 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 smYeZu http://blog.numino.net/ 复制代码你不能忽略这这个,不然下面安装必要库文件的时候会有些库装不上,要解决这个错误,输入下面命令apt-get install debian-archive-keyring VHzP3a http://blog.numino.net/ 复制代码然后重新输入上面两条命令,这次就没有错误了,你需要等几分钟等这个过程结束,这取决于你的VPS xo3Wy2 http://blog.numino.net/ 3.安装Transmission F5G6j1 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 f7jNS1 http://blog.numino.net/ 复制代码下载transmission,我这里下的是2.13,并不是最新版,因为最新的版本不在我常去PT的允许客户端列表里,你安装的时候也可以看看你所混的PT的FAQ,然后下载合适的版本,不然被Ban了不要怪我wget http://download.m0k.org/transmission/files/transmission-2.13.tar.bz2 XVeT47 http://blog.numino.net/ tar xvjf transmission-2.13.tar.bz2 0H66N5 http://blog.numino.net/ cd transmission-2.13 OzV6D6 http://blog.numino.net/ ./configure kHVUcC http://blog.numino.net/ 复制代码在./configure那一步出现错误:configure: error: libevent 1.4.9 or higher not found! YbxCKg 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 IXIOYX 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 I1w267 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 Dwkf1f http://blog.numino.net/ wget http://ftp.us.debian.org/debian/pool/main/libe/libevent/libevent-dev_1.4.13-stable-1_i386.deb gZluGL http://blog.numino.net/ dpkg -i *.deb MbW5u6 http://blog.numino.net/ 复制代码然后继续./configure D8KL6o http://blog.numino.net/ make qn3RvB http://blog.numino.net/ make install EL09IM http://blog.numino.net/ 复制代码 niU03Y http://blog.numino.net/ 4.安装Transmission的启动,停止脚本 hLU6Cd http://blog.numino.net/ 脚本在transmission网站有现成的,为了方便起见,我还是把它放在这里 Q6ffXF http://blog.numino.net/ #! /bin/sh S3eMV7 http://blog.numino.net/ ### BEGIN INIT INFO 7SggO5 http://blog.numino.net/ # Provides: transmission-daemon IGVfyd http://blog.numino.net/ # Required-Start: networking 9SxGFO http://blog.numino.net/ # Required-Stop: networking 5nmy2L http://blog.numino.net/ # Default-Start: 2 3 5 rhpnYs http://blog.numino.net/ # Default-Stop: 0 1 6 DPp4He http://blog.numino.net/ # Short-Description: Start the transmission BitTorrent daemon client. BWt73v http://blog.numino.net/ ### END INIT INFO 0Dgwpr http://blog.numino.net/ # Original Author: Lennart A. JÃŒtte, based on Rob Howell's script yqg2rd http://blog.numino.net/ # Modified by Maarten Van Coile & others (on IRC) Vyxv25 http://blog.numino.net/ # Do NOT "set -e" 55qNHt http://blog.numino.net/ # z1MPxi http://blog.numino.net/ # ----- CONFIGURATION ----- BCZ4jr http://blog.numino.net/ # xEov46 http://blog.numino.net/ # For the default location Transmission uses, visit: aldJey http://blog.numino.net/ # http://trac.transmissionbt.com/wiki/ConfigFiles Lv9hU0 http://blog.numino.net/ # For a guide on how set the preferences, visit: Q36g5p http://blog.numino.net/ # http://trac.transmissionbt.com/wiki/EditConfigFiles Ms5QEQ http://blog.numino.net/ # For the available environement variables, visit: 81HqpM http://blog.numino.net/ # http://trac.transmissionbt.com/wiki/EnvironmentVariables 7Sfcly http://blog.numino.net/ # 7Gt0HF http://blog.numino.net/ # The name of the user that should run Transmission. UUs1J2 http://blog.numino.net/ # It's RECOMENDED to run Transmission in it's own user, g81jMI http://blog.numino.net/ # by default, this is set to 'transmission'. Zc77A9 http://blog.numino.net/ # For the sake of security you shouldn't set a password 9K3DDS http://blog.numino.net/ # on this user NslJRr http://blog.numino.net/ USERNAME=transmission hbiDCh http://blog.numino.net/ # ----- *ADVANCED* CONFIGURATION ----- 5Cu987 http://blog.numino.net/ # Only change these options if you know what you are doing! 814u22 http://blog.numino.net/ # g149FF http://blog.numino.net/ # The folder where Transmission stores the config & web files. 0FRn6V http://blog.numino.net/ # ONLY change this you have it at a non-default location N7uQ37 http://blog.numino.net/ #TRANSMISSION_HOME="/var/config/transmission-daemon" bxExd1 http://blog.numino.net/ #TRANSMISSION_WEB_HOME="/usr/share/transmission/web" d788s3 http://blog.numino.net/ # HteGSi http://blog.numino.net/ # The arguments passed on to transmission-daemon. XLx5d2 http://blog.numino.net/ # ONLY change this you need to, otherwise use the 0W0ZKI http://blog.numino.net/ # settings file as per above. pH6LIv http://blog.numino.net/ #TRANSMISSION_ARGS="" V1lq2e http://blog.numino.net/ # ----- END OF CONFIGURATION ----- 4IjeM1 http://blog.numino.net/ # GU0GqR http://blog.numino.net/ # PATH should only include /usr/* if it runs after the mountnfs.sh script. c9O5mX http://blog.numino.net/ PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin dExwnV http://blog.numino.net/ DESC="bittorrent client" ex5B5f http://blog.numino.net/ NAME=transmission-daemon 09tNP5 http://blog.numino.net/ DAEMON=$(which $NAME) tpEQ5T http://blog.numino.net/ PIDFILE=/var/run/$NAME.pid ypO4yT http://blog.numino.net/ SCRIPTNAME=/etc/init.d/$NAME xNuXin http://blog.numino.net/ # Exit if the package is not installed w76Pow http://blog.numino.net/ [ -x "$DAEMON" ] || exit 0 zd9GAx http://blog.numino.net/ # Read configuration variable file if it is present V5FdeJ http://blog.numino.net/ [ -r /etc/default/$NAME ] && . /etc/default/$NAME sBZUi0 http://blog.numino.net/ # Load the VERBOSE setting and other rcS variables 7A6uDG http://blog.numino.net/ [ -f /etc/default/rcS ] && . /etc/default/rcS bTMVp4 http://blog.numino.net/ # Ok6HU4 http://blog.numino.net/ # Function that starts the daemon/service HeW8LV http://blog.numino.net/ # 368O17 http://blog.numino.net/ do_start() eZqy0C http://blog.numino.net/ { 2fhfPx http://blog.numino.net/ # Export the configuration/web directory, if set NoOr0z http://blog.numino.net/ if [ -n "$TRANSMISSION_HOME" ]; then AJ1U58 http://blog.numino.net/ export TRANSMISSION_HOME OdKymH http://blog.numino.net/ fi 1pE8qW http://blog.numino.net/ if [ -n "$TRANSMISSION_WEB_HOME" ]; then vgri4G http://blog.numino.net/ export TRANSMISSION_WEB_HOME sqdltG http://blog.numino.net/ fi rTVN4Z http://blog.numino.net/ # Return Ahn6Z7 http://blog.numino.net/ # 0 if daemon has been started 7R61oN http://blog.numino.net/ # 1 if daemon was already running tOTqaU http://blog.numino.net/ # 2 if daemon could not be started 42wIZ9 http://blog.numino.net/ start-stop-daemon --chuid $USERNAME --start --pidfile $PIDFILE --make-pidfile \ 357lP2 http://blog.numino.net/ --exec $DAEMON --background --test -- -f $TRANSMISSION_ARGS > /dev/null \ YxFV34 http://blog.numino.net/ || return 1 WN64lj http://blog.numino.net/ start-stop-daemon --chuid $USERNAME --start --pidfile $PIDFILE --make-pidfile \ CLqy25 http://blog.numino.net/ --exec $DAEMON --background -- -f $TRANSMISSION_ARGS \ 48335U http://blog.numino.net/ || return 2 rcz5Xg http://blog.numino.net/ } kfrMil http://blog.numino.net/ # 9c9x5M http://blog.numino.net/ # Function that stops the daemon/service NJ485x http://blog.numino.net/ # m5J2Fs http://blog.numino.net/ do_stop() 1MO75y http://blog.numino.net/ { SDJN2t http://blog.numino.net/ # Return F1F5QL http://blog.numino.net/ # 0 if daemon has been stopped MdX8J8 http://blog.numino.net/ # 1 if daemon was already stopped 6q2zK1 http://blog.numino.net/ # 2 if daemon could not be stopped SJUMNb http://blog.numino.net/ # other if a failure occurred Z8HIsR http://blog.numino.net/ start-stop-daemon --stop --quiet --retry=TERM/10/KILL/5 --pidfile $PIDFILE --name $NAME 86c1Dy http://blog.numino.net/ RETVAL="$?" wm7FBM http://blog.numino.net/ [ "$RETVAL" = 2 ] && return 2 9Y3HJJ http://blog.numino.net/ # Wait for children to finish too if this is a daemon that forks LVfzl9 http://blog.numino.net/ # and if the daemon is only ever run from this initscript. p1loT5 http://blog.numino.net/ # If the above conditions are not satisfied then add some other code 0GoEoK http://blog.numino.net/ # that waits for the process to drop all resources that could be ITEU8c http://blog.numino.net/ # needed by services started subsequently. A last resort is to cZiXxN http://blog.numino.net/ # sleep for some time. 7LEBK7 http://blog.numino.net/ start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON MNyViP http://blog.numino.net/ [ "$?" = 2 ] && return 2 Z779hJ http://blog.numino.net/ # Many daemons don't delete their pidfiles when they exit. sRDSq5 http://blog.numino.net/ rm -f $PIDFILE uCD400 http://blog.numino.net/ return "$RETVAL" TROiIA http://blog.numino.net/ } EtpTjr http://blog.numino.net/ case "$1" in guUP3T http://blog.numino.net/ start) 39OSFp http://blog.numino.net/ echo "Starting $DESC" "$NAME..." 8Y7dUO http://blog.numino.net/ do_start BuR1zT http://blog.numino.net/ case "$?" in 688r4x http://blog.numino.net/ 0|1) echo " Starting $DESC $NAME succeeded" ;; bgSze7 http://blog.numino.net/ *) echo " Starting $DESC $NAME failed" ;; 5bOz3l http://blog.numino.net/ esac xfMQKO http://blog.numino.net/ ;; BrO97W http://blog.numino.net/ stop) co8fL5 http://blog.numino.net/ echo "Stopping $DESC $NAME..." py88AT http://blog.numino.net/ do_stop 4U3GF0 http://blog.numino.net/ case "$?" in zKJO8m http://blog.numino.net/ 0|1) echo " Stopping $DESC $NAME succeeded" ;; sgiyKW http://blog.numino.net/ *) echo " Stopping $DESC $NAME failed" ;; 4irb4c http://blog.numino.net/ esac R275wX http://blog.numino.net/ ;; oL5xSa http://blog.numino.net/ restart|force-reload) 1oH784 http://blog.numino.net/ # DrIQQB http://blog.numino.net/ # If the "reload" option is implemented then remove the 4ct7Jt http://blog.numino.net/ # 'force-reload' alias 557e5s http://blog.numino.net/ # 1ta6ec http://blog.numino.net/ echo "Restarting $DESC $NAME..." HuX02a http://blog.numino.net/ do_stop sti4zk http://blog.numino.net/ case "$?" in 7Keutc http://blog.numino.net/ 0|1) 1x63tG http://blog.numino.net/ do_start WlCCJj http://blog.numino.net/ case "$?" in lLX3i1 http://blog.numino.net/ 0|1) echo " Restarting $DESC $NAME succeeded" ;; W5WKeu http://blog.numino.net/ *) echo " Restarting $DESC $NAME failed: couldn't start $NAME" ;; 8jwcAa http://blog.numino.net/ esac hWsFSz http://blog.numino.net/ ;; 9Yr9ZN http://blog.numino.net/ *) nMWEQK http://blog.numino.net/ echo " Restarting $DESC $NAME failed: couldn't stop $NAME" ;; d2JRPn http://blog.numino.net/ esac 90vRAP http://blog.numino.net/ ;; jQ43Uj http://blog.numino.net/ *) 3RHFiK http://blog.numino.net/ echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2 nlzB7h http://blog.numino.net/ exit 3 kETJxb http://blog.numino.net/ ;; 90k9X7 http://blog.numino.net/ esac VmTcHh http://blog.numino.net/ 复制代码这个脚本文件需要作为transmission-daemon放在/etc/init.d/下面,输入以下命令: 39Dhee http://blog.numino.net/ vi /etc/init.d/transmission-daemon QAt7G3 http://blog.numino.net/ 复制代码按i,然后把上面这个脚本粘帖进去,按ESC,然后按冒号:,输入wq,按回车,文件就建立好了 0Al3xj http://blog.numino.net/ 接下来更改文件的权限并使它在启动的时候可以自动执行: 708AeZ http://blog.numino.net/ chmod +x /etc/init.d/transmission-daemon 742B2F http://blog.numino.net/ chown root:root /etc/init.d/transmission-daemon q9Fo1W http://blog.numino.net/ update-rc.d transmission-daemon defaults DffnoF http://blog.numino.net/ 复制代码下来新建一个用户运行transmission,这里用的用户名是transmission,当然你也可以用其他的,不过记得要更改脚本了的USERNAME与之对应 t3dVw9 http://blog.numino.net/ useradd -mr transmission wkan39 http://blog.numino.net/ chmod g+rwx /home/transmission/ j63TeW http://blog.numino.net/ 复制代码 hNAV3S http://blog.numino.net/ 建立transmission的下载目录并设定权限: NwabQa http://blog.numino.net/ mkdir -p /home/transmission/Downloads/ yeJ3oF http://blog.numino.net/ chown -R transmission.transmission /home/transmission/Downloads/ Q6qhXC http://blog.numino.net/ chmod g+w /home/transmission/Downloads/ uqJduf http://blog.numino.net/ 复制代码接下来就可以启动transmission了: Jd5Tyr http://blog.numino.net/ /etc/init.d/transmission-daemon start IQ32pY http://blog.numino.net/ 复制代码 A12LuB http://blog.numino.net/ transmission启动后就自动会在/home/transmission/.config/transmission-daemon下生成settings.json文件,不过在你更改设置之前必须先停止transmission: 6nFo95 http://blog.numino.net/ /etc/init.d/transmission-daemon stop px9gdw http://blog.numino.net/ 复制代码这样你就可以开始更改设置了: uK0vh9 http://blog.numino.net/ vi /home/transmission/.config/transmission-daemon/settings.json Q4aMvc http://blog.numino.net/ 复制代码按i以后就可以开始编辑了,至于参数什么意思请参考transmission的网站,改完后按ESC, 按冒号:,输入wq回车存盘 b85w59 http://blog.numino.net/ 为了方便你在家里的电脑上用Transmission Remote GUI的连上去管理,下面的设置你必须更改: 4hv0bC http://blog.numino.net/ "rpc-whitelist-enabled": false - 默认是true,要改为false 6iaZbc http://blog.numino.net/ “rpc-password": "密码", b0bT4R http://blog.numino.net/ "rpc-username": "用户名", G3Y1Vy http://blog.numino.net/ 上面的密码和用户名你可以自己指定 58u12H http://blog.numino.net/ 复制代码 ZAEa6u http://blog.numino.net/ 从新启动transmission,新的设置就会生效: B96lyX http://blog.numino.net/ /etc/init.d/transmission-daemon start 6pxXZ2 http://blog.numino.net/ 复制代码现在你可以下载并安装Transmission Remote GUI,在GUI的options输入VPS的IP地址,rpc的端口(默认是9091,你可以在settings.json中改成其他的),你的用户名和密码,就可以连到你VPS上的transmission了 86e0ng http://blog.numino.net/ Transmission Remote GUI的下载地址: 4PC41c http://blog.numino.net/ http://transmisson-remote-gui.googlecode.com/files/transgui-2.2-setup.exe WoHZ4A http://blog.numino.net/ 复制代码另外如果你用Android的手机,可以在菜市场搜索安装Transdroid,它可以很方便的在手机上管理transmission,也可以在手机上下载torrent,通过它传到vps的transmission里进行下载,非常方便 uKRlN5 http://blog.numino.net/ 至此transmission在debian的安装就告一段落了,下来有时间我会写一下如何通过rss和irc自动下载torrent并传给transmission进行下载
|
|