| VPS上用debian装transmission教程 |
1. 前言: NksPk1 http://blog.numino.net/ 原来都是在Centos上装Transmission挂PT的,这两天在折腾我的VPS,分别试着在Centos和Debian上安装了rtorrent+rutorrent,结果发现rtorrent和transmission相比,并不是很稳定,经常崩溃,虽然可以写脚本定时检查重启,但每次重启都会重新hash文件,问题多多,所以个人以为还是transmission比较合适个人安装使用,之所以rtorrent很多seedbox在用,主要是它比较容易支持多用户,适合多人共享。最终决定还是装回transmission,因为reload的OS是debian,所以也不准备换成centos,于是就有了这篇教程。 nQ0cjS http://blog.numino.net/ 2.升级系统 vyHwTr http://blog.numino.net/ 我这里reload的是debian-5.0x86的,不同的版本有可能出现的错误不一样,有问题可以跟贴问,为了方便,我这里都是用root登录安装的 d2UqN4 http://blog.numino.net/ 首先升级系统:apt-get update QoDphR http://blog.numino.net/ apt-get upgrade 2FYm4C 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 0aedhd http://blog.numino.net/ 复制代码你不能忽略这这个,不然下面安装必要库文件的时候会有些库装不上,要解决这个错误,输入下面命令apt-get install debian-archive-keyring GpjT4m http://blog.numino.net/ 复制代码然后重新输入上面两条命令,这次就没有错误了,你需要等几分钟等这个过程结束,这取决于你的VPS 56Fjhq http://blog.numino.net/ 3.安装Transmission On8Ndw 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 D4PKEf http://blog.numino.net/ 复制代码下载transmission,我这里下的是2.13,并不是最新版,因为最新的版本不在我常去PT的允许客户端列表里,你安装的时候也可以看看你所混的PT的FAQ,然后下载合适的版本,不然被Ban了不要怪我wget http://download.m0k.org/transmission/files/transmission-2.13.tar.bz2 u7Zpsa http://blog.numino.net/ tar xvjf transmission-2.13.tar.bz2 8J9PPn http://blog.numino.net/ cd transmission-2.13 G6r42d http://blog.numino.net/ ./configure kK76w9 http://blog.numino.net/ 复制代码在./configure那一步出现错误:configure: error: libevent 1.4.9 or higher not found! B1IHwB 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 7UmQT3 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 RNtyxA 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 JQIgS8 http://blog.numino.net/ wget http://ftp.us.debian.org/debian/pool/main/libe/libevent/libevent-dev_1.4.13-stable-1_i386.deb ZpClZN http://blog.numino.net/ dpkg -i *.deb 0i3kyE http://blog.numino.net/ 复制代码然后继续./configure vMfKuj http://blog.numino.net/ make 2YnS8w http://blog.numino.net/ make install 1cubrH http://blog.numino.net/ 复制代码 119Mfg http://blog.numino.net/ 4.安装Transmission的启动,停止脚本 HNtVrx http://blog.numino.net/ 脚本在transmission网站有现成的,为了方便起见,我还是把它放在这里 xN5lHF http://blog.numino.net/ #! /bin/sh kXou3g http://blog.numino.net/ ### BEGIN INIT INFO S50mV9 http://blog.numino.net/ # Provides: transmission-daemon i6oTyT http://blog.numino.net/ # Required-Start: networking G4ACFU http://blog.numino.net/ # Required-Stop: networking 1qhTAe http://blog.numino.net/ # Default-Start: 2 3 5 Zh5GX8 http://blog.numino.net/ # Default-Stop: 0 1 6 U2fucd http://blog.numino.net/ # Short-Description: Start the transmission BitTorrent daemon client. RzKijL http://blog.numino.net/ ### END INIT INFO eZ8vr1 http://blog.numino.net/ # Original Author: Lennart A. JÃŒtte, based on Rob Howell's script 0OUgfx http://blog.numino.net/ # Modified by Maarten Van Coile & others (on IRC) 6kSSJL http://blog.numino.net/ # Do NOT "set -e" GK2Dla http://blog.numino.net/ # ibXKN4 http://blog.numino.net/ # ----- CONFIGURATION ----- E7da85 http://blog.numino.net/ # P82hpq http://blog.numino.net/ # For the default location Transmission uses, visit: mlU7m9 http://blog.numino.net/ # http://trac.transmissionbt.com/wiki/ConfigFiles H7OPxJ http://blog.numino.net/ # For a guide on how set the preferences, visit: 2ey2MJ http://blog.numino.net/ # http://trac.transmissionbt.com/wiki/EditConfigFiles 7UPkhH http://blog.numino.net/ # For the available environement variables, visit: P9xHxR http://blog.numino.net/ # http://trac.transmissionbt.com/wiki/EnvironmentVariables LOjjgM http://blog.numino.net/ # 6cV9W9 http://blog.numino.net/ # The name of the user that should run Transmission. QoP2QD http://blog.numino.net/ # It's RECOMENDED to run Transmission in it's own user, rfIN7U http://blog.numino.net/ # by default, this is set to 'transmission'. iIiRbr http://blog.numino.net/ # For the sake of security you shouldn't set a password 34nBh1 http://blog.numino.net/ # on this user Oglnr0 http://blog.numino.net/ USERNAME=transmission 3PzQwQ http://blog.numino.net/ # ----- *ADVANCED* CONFIGURATION ----- zWc5A5 http://blog.numino.net/ # Only change these options if you know what you are doing! nhgf5i http://blog.numino.net/ # EI9zDo http://blog.numino.net/ # The folder where Transmission stores the config & web files. Y1n7oe http://blog.numino.net/ # ONLY change this you have it at a non-default location 6538Iy http://blog.numino.net/ #TRANSMISSION_HOME="/var/config/transmission-daemon" QKch3a http://blog.numino.net/ #TRANSMISSION_WEB_HOME="/usr/share/transmission/web" 0srt3x http://blog.numino.net/ # 4HTWHr http://blog.numino.net/ # The arguments passed on to transmission-daemon. xU6uWp http://blog.numino.net/ # ONLY change this you need to, otherwise use the I7dybD http://blog.numino.net/ # settings file as per above. IBuX5k http://blog.numino.net/ #TRANSMISSION_ARGS="" J070C6 http://blog.numino.net/ # ----- END OF CONFIGURATION ----- JGkd2O http://blog.numino.net/ # sH4h8L http://blog.numino.net/ # PATH should only include /usr/* if it runs after the mountnfs.sh script. 1uw0Sc http://blog.numino.net/ PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin 9mz99V http://blog.numino.net/ DESC="bittorrent client" hn1Bj5 http://blog.numino.net/ NAME=transmission-daemon dFREFP http://blog.numino.net/ DAEMON=$(which $NAME) 996Pol http://blog.numino.net/ PIDFILE=/var/run/$NAME.pid 5rD569 http://blog.numino.net/ SCRIPTNAME=/etc/init.d/$NAME cYw6c9 http://blog.numino.net/ # Exit if the package is not installed 14ZmZ7 http://blog.numino.net/ [ -x "$DAEMON" ] || exit 0 NsZ1t0 http://blog.numino.net/ # Read configuration variable file if it is present KEV6B1 http://blog.numino.net/ [ -r /etc/default/$NAME ] && . /etc/default/$NAME sIy019 http://blog.numino.net/ # Load the VERBOSE setting and other rcS variables kRghdp http://blog.numino.net/ [ -f /etc/default/rcS ] && . /etc/default/rcS AVVBox http://blog.numino.net/ # bkwyX1 http://blog.numino.net/ # Function that starts the daemon/service 6xKzeh http://blog.numino.net/ # 0IHv5N http://blog.numino.net/ do_start() Bt0xaQ http://blog.numino.net/ { C9I1dT http://blog.numino.net/ # Export the configuration/web directory, if set kUDjkh http://blog.numino.net/ if [ -n "$TRANSMISSION_HOME" ]; then 58x6qh http://blog.numino.net/ export TRANSMISSION_HOME 8Fm0R4 http://blog.numino.net/ fi Y9Cr30 http://blog.numino.net/ if [ -n "$TRANSMISSION_WEB_HOME" ]; then iTBkjz http://blog.numino.net/ export TRANSMISSION_WEB_HOME l14b5g http://blog.numino.net/ fi k4JKe2 http://blog.numino.net/ # Return N9SNrk http://blog.numino.net/ # 0 if daemon has been started ye5Ifs http://blog.numino.net/ # 1 if daemon was already running j7r5Et http://blog.numino.net/ # 2 if daemon could not be started RNo9H7 http://blog.numino.net/ start-stop-daemon --chuid $USERNAME --start --pidfile $PIDFILE --make-pidfile \ K73ZLw http://blog.numino.net/ --exec $DAEMON --background --test -- -f $TRANSMISSION_ARGS > /dev/null \ StTWHf http://blog.numino.net/ || return 1 MnsmS4 http://blog.numino.net/ start-stop-daemon --chuid $USERNAME --start --pidfile $PIDFILE --make-pidfile \ z8HxA9 http://blog.numino.net/ --exec $DAEMON --background -- -f $TRANSMISSION_ARGS \ bfUMPq http://blog.numino.net/ || return 2 vZISh9 http://blog.numino.net/ } EdHhYL http://blog.numino.net/ # SC4FTs http://blog.numino.net/ # Function that stops the daemon/service bW0WHX http://blog.numino.net/ # 1I50xj http://blog.numino.net/ do_stop() HuLKdw http://blog.numino.net/ { PPUhAd http://blog.numino.net/ # Return 8pJlnW http://blog.numino.net/ # 0 if daemon has been stopped 0pnZDu http://blog.numino.net/ # 1 if daemon was already stopped tLmeHc http://blog.numino.net/ # 2 if daemon could not be stopped pcff14 http://blog.numino.net/ # other if a failure occurred I4bZMI http://blog.numino.net/ start-stop-daemon --stop --quiet --retry=TERM/10/KILL/5 --pidfile $PIDFILE --name $NAME 6rWBhd http://blog.numino.net/ RETVAL="$?" pThaZj http://blog.numino.net/ [ "$RETVAL" = 2 ] && return 2 HAXr0r http://blog.numino.net/ # Wait for children to finish too if this is a daemon that forks 784TJ6 http://blog.numino.net/ # and if the daemon is only ever run from this initscript. I95uw4 http://blog.numino.net/ # If the above conditions are not satisfied then add some other code a334g1 http://blog.numino.net/ # that waits for the process to drop all resources that could be TqhHr2 http://blog.numino.net/ # needed by services started subsequently. A last resort is to vEJuae http://blog.numino.net/ # sleep for some time. vb1AhH http://blog.numino.net/ start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON D2TLT8 http://blog.numino.net/ [ "$?" = 2 ] && return 2 sf2516 http://blog.numino.net/ # Many daemons don't delete their pidfiles when they exit. EqIk2U http://blog.numino.net/ rm -f $PIDFILE BULUO1 http://blog.numino.net/ return "$RETVAL" IAS260 http://blog.numino.net/ } 5wB3hb http://blog.numino.net/ case "$1" in U1K75z http://blog.numino.net/ start) eaZEV0 http://blog.numino.net/ echo "Starting $DESC" "$NAME..." UKI5h7 http://blog.numino.net/ do_start U10bYg http://blog.numino.net/ case "$?" in Fi9u9q http://blog.numino.net/ 0|1) echo " Starting $DESC $NAME succeeded" ;; Nn534R http://blog.numino.net/ *) echo " Starting $DESC $NAME failed" ;; 10k1GV http://blog.numino.net/ esac Blp528 http://blog.numino.net/ ;; C5eH9C http://blog.numino.net/ stop) pbOuCK http://blog.numino.net/ echo "Stopping $DESC $NAME..." VsDOMQ http://blog.numino.net/ do_stop Aib9zD http://blog.numino.net/ case "$?" in 0mChUw http://blog.numino.net/ 0|1) echo " Stopping $DESC $NAME succeeded" ;; 91FRJ1 http://blog.numino.net/ *) echo " Stopping $DESC $NAME failed" ;; 7g40N2 http://blog.numino.net/ esac 4eC1PL http://blog.numino.net/ ;; 01kA3X http://blog.numino.net/ restart|force-reload) F79gnV http://blog.numino.net/ # x3X4dH http://blog.numino.net/ # If the "reload" option is implemented then remove the 6Xqkv9 http://blog.numino.net/ # 'force-reload' alias nW3nLS http://blog.numino.net/ # 20qHW1 http://blog.numino.net/ echo "Restarting $DESC $NAME..." Q4nZTR http://blog.numino.net/ do_stop Ci9zFb http://blog.numino.net/ case "$?" in x46SxM http://blog.numino.net/ 0|1) 48aTNJ http://blog.numino.net/ do_start 9Ucpk3 http://blog.numino.net/ case "$?" in 9Y2D38 http://blog.numino.net/ 0|1) echo " Restarting $DESC $NAME succeeded" ;; JbgkIN http://blog.numino.net/ *) echo " Restarting $DESC $NAME failed: couldn't start $NAME" ;; odsj8J http://blog.numino.net/ esac BmLVu0 http://blog.numino.net/ ;; h3465w http://blog.numino.net/ *) 3D10s6 http://blog.numino.net/ echo " Restarting $DESC $NAME failed: couldn't stop $NAME" ;; U87SJ4 http://blog.numino.net/ esac UBjJZD http://blog.numino.net/ ;; bLHSiT http://blog.numino.net/ *) 515UW2 http://blog.numino.net/ echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2 fOL7D4 http://blog.numino.net/ exit 3 GAosRa http://blog.numino.net/ ;; 0QNjaP http://blog.numino.net/ esac fzZ1y3 http://blog.numino.net/ 复制代码这个脚本文件需要作为transmission-daemon放在/etc/init.d/下面,输入以下命令: PTKPRX http://blog.numino.net/ vi /etc/init.d/transmission-daemon IQuZ0N http://blog.numino.net/ 复制代码按i,然后把上面这个脚本粘帖进去,按ESC,然后按冒号:,输入wq,按回车,文件就建立好了 B5b6YP http://blog.numino.net/ 接下来更改文件的权限并使它在启动的时候可以自动执行: 02FkJi http://blog.numino.net/ chmod +x /etc/init.d/transmission-daemon HBYB58 http://blog.numino.net/ chown root:root /etc/init.d/transmission-daemon tzudeu http://blog.numino.net/ update-rc.d transmission-daemon defaults 062xju http://blog.numino.net/ 复制代码下来新建一个用户运行transmission,这里用的用户名是transmission,当然你也可以用其他的,不过记得要更改脚本了的USERNAME与之对应 9Vq66M http://blog.numino.net/ useradd -mr transmission 0rb6fh http://blog.numino.net/ chmod g+rwx /home/transmission/ nvl7IN http://blog.numino.net/ 复制代码 dZZhii http://blog.numino.net/ 建立transmission的下载目录并设定权限: 0BiR3X http://blog.numino.net/ mkdir -p /home/transmission/Downloads/ m9gBku http://blog.numino.net/ chown -R transmission.transmission /home/transmission/Downloads/ 4A8qQ9 http://blog.numino.net/ chmod g+w /home/transmission/Downloads/ frUuTB http://blog.numino.net/ 复制代码接下来就可以启动transmission了: yF07I6 http://blog.numino.net/ /etc/init.d/transmission-daemon start dtOaJt http://blog.numino.net/ 复制代码 NpC91O http://blog.numino.net/ transmission启动后就自动会在/home/transmission/.config/transmission-daemon下生成settings.json文件,不过在你更改设置之前必须先停止transmission: A4OqTo http://blog.numino.net/ /etc/init.d/transmission-daemon stop RWeXJC http://blog.numino.net/ 复制代码这样你就可以开始更改设置了: gGB86N http://blog.numino.net/ vi /home/transmission/.config/transmission-daemon/settings.json t9Q2s9 http://blog.numino.net/ 复制代码按i以后就可以开始编辑了,至于参数什么意思请参考transmission的网站,改完后按ESC, 按冒号:,输入wq回车存盘 B58vnW http://blog.numino.net/ 为了方便你在家里的电脑上用Transmission Remote GUI的连上去管理,下面的设置你必须更改: Fp8dUz http://blog.numino.net/ "rpc-whitelist-enabled": false - 默认是true,要改为false 8zIH8j http://blog.numino.net/ “rpc-password": "密码", WeUo6j http://blog.numino.net/ "rpc-username": "用户名", R9PNCf http://blog.numino.net/ 上面的密码和用户名你可以自己指定 p6DbPV http://blog.numino.net/ 复制代码 RAtP0D http://blog.numino.net/ 从新启动transmission,新的设置就会生效: 06nDm6 http://blog.numino.net/ /etc/init.d/transmission-daemon start WAKL1M http://blog.numino.net/ 复制代码现在你可以下载并安装Transmission Remote GUI,在GUI的options输入VPS的IP地址,rpc的端口(默认是9091,你可以在settings.json中改成其他的),你的用户名和密码,就可以连到你VPS上的transmission了 Vx7CyO http://blog.numino.net/ Transmission Remote GUI的下载地址: wbujmM http://blog.numino.net/ http://transmisson-remote-gui.googlecode.com/files/transgui-2.2-setup.exe mci2AT http://blog.numino.net/ 复制代码另外如果你用Android的手机,可以在菜市场搜索安装Transdroid,它可以很方便的在手机上管理transmission,也可以在手机上下载torrent,通过它传到vps的transmission里进行下载,非常方便 vPuff4 http://blog.numino.net/ 至此transmission在debian的安装就告一段落了,下来有时间我会写一下如何通过rss和irc自动下载torrent并传给transmission进行下载
|
|