VPS上用debian装transmission教程 |
1. 前言: 87pJoy http://blog.numino.net/ 原来都是在Centos上装Transmission挂PT的,这两天在折腾我的VPS,分别试着在Centos和Debian上安装了rtorrent+rutorrent,结果发现rtorrent和transmission相比,并不是很稳定,经常崩溃,虽然可以写脚本定时检查重启,但每次重启都会重新hash文件,问题多多,所以个人以为还是transmission比较合适个人安装使用,之所以rtorrent很多seedbox在用,主要是它比较容易支持多用户,适合多人共享。最终决定还是装回transmission,因为reload的OS是debian,所以也不准备换成centos,于是就有了这篇教程。 zoMK7S http://blog.numino.net/ 2.升级系统 1YRj9e http://blog.numino.net/ 我这里reload的是debian-5.0x86的,不同的版本有可能出现的错误不一样,有问题可以跟贴问,为了方便,我这里都是用root登录安装的 xb6pAz http://blog.numino.net/ 首先升级系统:apt-get update M2u4D9 http://blog.numino.net/ apt-get upgrade alsE1V 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 z5587F http://blog.numino.net/ 复制代码你不能忽略这这个,不然下面安装必要库文件的时候会有些库装不上,要解决这个错误,输入下面命令apt-get install debian-archive-keyring VkWqR9 http://blog.numino.net/ 复制代码然后重新输入上面两条命令,这次就没有错误了,你需要等几分钟等这个过程结束,这取决于你的VPS ge1yIx http://blog.numino.net/ 3.安装Transmission r3ks1B 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 o0tj2O http://blog.numino.net/ 复制代码下载transmission,我这里下的是2.13,并不是最新版,因为最新的版本不在我常去PT的允许客户端列表里,你安装的时候也可以看看你所混的PT的FAQ,然后下载合适的版本,不然被Ban了不要怪我wget http://download.m0k.org/transmission/files/transmission-2.13.tar.bz2 UhR06s http://blog.numino.net/ tar xvjf transmission-2.13.tar.bz2 6c7PU0 http://blog.numino.net/ cd transmission-2.13 hb6tNK http://blog.numino.net/ ./configure kd22Fy http://blog.numino.net/ 复制代码在./configure那一步出现错误:configure: error: libevent 1.4.9 or higher not found! rw08By 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 Vc2f9p 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 R1SwQ5 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 8BVO3g http://blog.numino.net/ wget http://ftp.us.debian.org/debian/pool/main/libe/libevent/libevent-dev_1.4.13-stable-1_i386.deb BeTC7c http://blog.numino.net/ dpkg -i *.deb 505793 http://blog.numino.net/ 复制代码然后继续./configure 72QRx2 http://blog.numino.net/ make UsrzV4 http://blog.numino.net/ make install iPacFS http://blog.numino.net/ 复制代码 OAN6Nc http://blog.numino.net/ 4.安装Transmission的启动,停止脚本 RkG4mf http://blog.numino.net/ 脚本在transmission网站有现成的,为了方便起见,我还是把它放在这里 Rus7We http://blog.numino.net/ #! /bin/sh 82tK7K http://blog.numino.net/ ### BEGIN INIT INFO meeRvw http://blog.numino.net/ # Provides: transmission-daemon tndTPx http://blog.numino.net/ # Required-Start: networking 3RgmX5 http://blog.numino.net/ # Required-Stop: networking P8btM6 http://blog.numino.net/ # Default-Start: 2 3 5 9T25uh http://blog.numino.net/ # Default-Stop: 0 1 6 7hzz03 http://blog.numino.net/ # Short-Description: Start the transmission BitTorrent daemon client. kOpC74 http://blog.numino.net/ ### END INIT INFO 8RVuhr http://blog.numino.net/ # Original Author: Lennart A. JÃŒtte, based on Rob Howell's script c0k68X http://blog.numino.net/ # Modified by Maarten Van Coile & others (on IRC) 154fkl http://blog.numino.net/ # Do NOT "set -e" Q3JsOV http://blog.numino.net/ # 647t3l http://blog.numino.net/ # ----- CONFIGURATION ----- 5Vq15d http://blog.numino.net/ # pC6cAz http://blog.numino.net/ # For the default location Transmission uses, visit: b1EJGg http://blog.numino.net/ # http://trac.transmissionbt.com/wiki/ConfigFiles t7HQXn http://blog.numino.net/ # For a guide on how set the preferences, visit: 3kLd2Z http://blog.numino.net/ # http://trac.transmissionbt.com/wiki/EditConfigFiles yX2287 http://blog.numino.net/ # For the available environement variables, visit: X80k1L http://blog.numino.net/ # http://trac.transmissionbt.com/wiki/EnvironmentVariables 4iJ9eY http://blog.numino.net/ # 4DjsR4 http://blog.numino.net/ # The name of the user that should run Transmission. 428UMT http://blog.numino.net/ # It's RECOMENDED to run Transmission in it's own user, GBND0w http://blog.numino.net/ # by default, this is set to 'transmission'. syPt72 http://blog.numino.net/ # For the sake of security you shouldn't set a password 505xug http://blog.numino.net/ # on this user UVKO0x http://blog.numino.net/ USERNAME=transmission M4XNiZ http://blog.numino.net/ # ----- *ADVANCED* CONFIGURATION ----- Lmd23q http://blog.numino.net/ # Only change these options if you know what you are doing! rzN03F http://blog.numino.net/ # D5kHS5 http://blog.numino.net/ # The folder where Transmission stores the config & web files. 7R147Q http://blog.numino.net/ # ONLY change this you have it at a non-default location pRyM8y http://blog.numino.net/ #TRANSMISSION_HOME="/var/config/transmission-daemon" 6Hz0q1 http://blog.numino.net/ #TRANSMISSION_WEB_HOME="/usr/share/transmission/web" yeQZdw http://blog.numino.net/ # 57LYV0 http://blog.numino.net/ # The arguments passed on to transmission-daemon. dr7u2N http://blog.numino.net/ # ONLY change this you need to, otherwise use the 2R0qSl http://blog.numino.net/ # settings file as per above. UwKG9r http://blog.numino.net/ #TRANSMISSION_ARGS="" 03p9AQ http://blog.numino.net/ # ----- END OF CONFIGURATION ----- j6Cy4v http://blog.numino.net/ # sNNTzf http://blog.numino.net/ # PATH should only include /usr/* if it runs after the mountnfs.sh script. pIs5qK http://blog.numino.net/ PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin 7wUF9I http://blog.numino.net/ DESC="bittorrent client" sL0dN6 http://blog.numino.net/ NAME=transmission-daemon u5k16O http://blog.numino.net/ DAEMON=$(which $NAME) YkW6XE http://blog.numino.net/ PIDFILE=/var/run/$NAME.pid 0N7q02 http://blog.numino.net/ SCRIPTNAME=/etc/init.d/$NAME t4eNTf http://blog.numino.net/ # Exit if the package is not installed yN3Crx http://blog.numino.net/ [ -x "$DAEMON" ] || exit 0 j1HyL6 http://blog.numino.net/ # Read configuration variable file if it is present f4b60P http://blog.numino.net/ [ -r /etc/default/$NAME ] && . /etc/default/$NAME VgRUIe http://blog.numino.net/ # Load the VERBOSE setting and other rcS variables Tq29DD http://blog.numino.net/ [ -f /etc/default/rcS ] && . /etc/default/rcS gkFF5g http://blog.numino.net/ # 3W8f3m http://blog.numino.net/ # Function that starts the daemon/service 3Z7aKo http://blog.numino.net/ # GfC5vj http://blog.numino.net/ do_start() wMkd2A http://blog.numino.net/ { BLQVr4 http://blog.numino.net/ # Export the configuration/web directory, if set cY8Q2d http://blog.numino.net/ if [ -n "$TRANSMISSION_HOME" ]; then 8DMCws http://blog.numino.net/ export TRANSMISSION_HOME F1l2P2 http://blog.numino.net/ fi T0ChlN http://blog.numino.net/ if [ -n "$TRANSMISSION_WEB_HOME" ]; then v1gazL http://blog.numino.net/ export TRANSMISSION_WEB_HOME bHFQJy http://blog.numino.net/ fi G3G1SI http://blog.numino.net/ # Return NO5c6K http://blog.numino.net/ # 0 if daemon has been started HS15bl http://blog.numino.net/ # 1 if daemon was already running 4ZFc0H http://blog.numino.net/ # 2 if daemon could not be started ZTC9Xl http://blog.numino.net/ start-stop-daemon --chuid $USERNAME --start --pidfile $PIDFILE --make-pidfile \ Cwzw2o http://blog.numino.net/ --exec $DAEMON --background --test -- -f $TRANSMISSION_ARGS > /dev/null \ 4Ph323 http://blog.numino.net/ || return 1 alKl85 http://blog.numino.net/ start-stop-daemon --chuid $USERNAME --start --pidfile $PIDFILE --make-pidfile \ 1CKtjS http://blog.numino.net/ --exec $DAEMON --background -- -f $TRANSMISSION_ARGS \ Uw7A59 http://blog.numino.net/ || return 2 I6HkGJ http://blog.numino.net/ } 53roo1 http://blog.numino.net/ # F29RPH http://blog.numino.net/ # Function that stops the daemon/service 3Rs7m8 http://blog.numino.net/ # og8VML http://blog.numino.net/ do_stop() ZcFCt7 http://blog.numino.net/ { qJX51m http://blog.numino.net/ # Return Zl5b0W http://blog.numino.net/ # 0 if daemon has been stopped cdlkcL http://blog.numino.net/ # 1 if daemon was already stopped sIAei0 http://blog.numino.net/ # 2 if daemon could not be stopped eYGPJ7 http://blog.numino.net/ # other if a failure occurred 3w0YYI http://blog.numino.net/ start-stop-daemon --stop --quiet --retry=TERM/10/KILL/5 --pidfile $PIDFILE --name $NAME kQksc5 http://blog.numino.net/ RETVAL="$?" mDcUkk http://blog.numino.net/ [ "$RETVAL" = 2 ] && return 2 f4a41E http://blog.numino.net/ # Wait for children to finish too if this is a daemon that forks dZ969w http://blog.numino.net/ # and if the daemon is only ever run from this initscript. fu7vWE http://blog.numino.net/ # If the above conditions are not satisfied then add some other code 1fWQC1 http://blog.numino.net/ # that waits for the process to drop all resources that could be X0uFpz http://blog.numino.net/ # needed by services started subsequently. A last resort is to p5r5Yr http://blog.numino.net/ # sleep for some time. VUjK2K http://blog.numino.net/ start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON fU3Elh http://blog.numino.net/ [ "$?" = 2 ] && return 2 RTHd71 http://blog.numino.net/ # Many daemons don't delete their pidfiles when they exit. fhXRld http://blog.numino.net/ rm -f $PIDFILE AF4Ku7 http://blog.numino.net/ return "$RETVAL" eVNAvQ http://blog.numino.net/ } 0u2z2R http://blog.numino.net/ case "$1" in dI8dk0 http://blog.numino.net/ start) oNm5n8 http://blog.numino.net/ echo "Starting $DESC" "$NAME..." xx2h6w http://blog.numino.net/ do_start 94zS59 http://blog.numino.net/ case "$?" in 09pw33 http://blog.numino.net/ 0|1) echo " Starting $DESC $NAME succeeded" ;; P90D67 http://blog.numino.net/ *) echo " Starting $DESC $NAME failed" ;; 18BSGQ http://blog.numino.net/ esac ZPCaD2 http://blog.numino.net/ ;; oxPImv http://blog.numino.net/ stop) 305OvB http://blog.numino.net/ echo "Stopping $DESC $NAME..." vnHE3L http://blog.numino.net/ do_stop NSwd54 http://blog.numino.net/ case "$?" in Zf7nm4 http://blog.numino.net/ 0|1) echo " Stopping $DESC $NAME succeeded" ;; QVC5R4 http://blog.numino.net/ *) echo " Stopping $DESC $NAME failed" ;; bd38pX http://blog.numino.net/ esac b71aE8 http://blog.numino.net/ ;; j6KPWc http://blog.numino.net/ restart|force-reload) jjh2GD http://blog.numino.net/ # 7S6qs1 http://blog.numino.net/ # If the "reload" option is implemented then remove the OmOahb http://blog.numino.net/ # 'force-reload' alias ks5JD9 http://blog.numino.net/ # 7uGwYE http://blog.numino.net/ echo "Restarting $DESC $NAME..." b1TxA0 http://blog.numino.net/ do_stop zf3b5g http://blog.numino.net/ case "$?" in q4XVNn http://blog.numino.net/ 0|1) yeKI3S http://blog.numino.net/ do_start 1lG2Cz http://blog.numino.net/ case "$?" in Ehp49b http://blog.numino.net/ 0|1) echo " Restarting $DESC $NAME succeeded" ;; g6C5tW http://blog.numino.net/ *) echo " Restarting $DESC $NAME failed: couldn't start $NAME" ;; 5Sje6z http://blog.numino.net/ esac pib5zZ http://blog.numino.net/ ;; 1owldj http://blog.numino.net/ *) rjx1yZ http://blog.numino.net/ echo " Restarting $DESC $NAME failed: couldn't stop $NAME" ;; U29kGm http://blog.numino.net/ esac G6Gj11 http://blog.numino.net/ ;; VN7sU8 http://blog.numino.net/ *) 06TTDk http://blog.numino.net/ echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2 05nsH1 http://blog.numino.net/ exit 3 1jMFo2 http://blog.numino.net/ ;; j8b312 http://blog.numino.net/ esac z62JhT http://blog.numino.net/ 复制代码这个脚本文件需要作为transmission-daemon放在/etc/init.d/下面,输入以下命令: 38WC5y http://blog.numino.net/ vi /etc/init.d/transmission-daemon qe2dPf http://blog.numino.net/ 复制代码按i,然后把上面这个脚本粘帖进去,按ESC,然后按冒号:,输入wq,按回车,文件就建立好了 THc714 http://blog.numino.net/ 接下来更改文件的权限并使它在启动的时候可以自动执行: 0xnpbA http://blog.numino.net/ chmod +x /etc/init.d/transmission-daemon oACUot http://blog.numino.net/ chown root:root /etc/init.d/transmission-daemon gmo65b http://blog.numino.net/ update-rc.d transmission-daemon defaults CULq10 http://blog.numino.net/ 复制代码下来新建一个用户运行transmission,这里用的用户名是transmission,当然你也可以用其他的,不过记得要更改脚本了的USERNAME与之对应 aFYG3w http://blog.numino.net/ useradd -mr transmission 18F90F http://blog.numino.net/ chmod g+rwx /home/transmission/ JZbEru http://blog.numino.net/ 复制代码 6IHzJD http://blog.numino.net/ 建立transmission的下载目录并设定权限: j2lF3R http://blog.numino.net/ mkdir -p /home/transmission/Downloads/ Cwt83E http://blog.numino.net/ chown -R transmission.transmission /home/transmission/Downloads/ 42G6jG http://blog.numino.net/ chmod g+w /home/transmission/Downloads/ uxPrzs http://blog.numino.net/ 复制代码接下来就可以启动transmission了: INrA0B http://blog.numino.net/ /etc/init.d/transmission-daemon start 4y1ny8 http://blog.numino.net/ 复制代码 mp5ua9 http://blog.numino.net/ transmission启动后就自动会在/home/transmission/.config/transmission-daemon下生成settings.json文件,不过在你更改设置之前必须先停止transmission: Ri5ztG http://blog.numino.net/ /etc/init.d/transmission-daemon stop 8L225D http://blog.numino.net/ 复制代码这样你就可以开始更改设置了: u0L3BP http://blog.numino.net/ vi /home/transmission/.config/transmission-daemon/settings.json yI4L93 http://blog.numino.net/ 复制代码按i以后就可以开始编辑了,至于参数什么意思请参考transmission的网站,改完后按ESC, 按冒号:,输入wq回车存盘 aGrzgK http://blog.numino.net/ 为了方便你在家里的电脑上用Transmission Remote GUI的连上去管理,下面的设置你必须更改: usdC2x http://blog.numino.net/ "rpc-whitelist-enabled": false - 默认是true,要改为false gphMIS http://blog.numino.net/ “rpc-password": "密码", I93fgy http://blog.numino.net/ "rpc-username": "用户名", 28mRy1 http://blog.numino.net/ 上面的密码和用户名你可以自己指定 nfz0r8 http://blog.numino.net/ 复制代码 8GHGoc http://blog.numino.net/ 从新启动transmission,新的设置就会生效: 5Y6R84 http://blog.numino.net/ /etc/init.d/transmission-daemon start 336Q59 http://blog.numino.net/ 复制代码现在你可以下载并安装Transmission Remote GUI,在GUI的options输入VPS的IP地址,rpc的端口(默认是9091,你可以在settings.json中改成其他的),你的用户名和密码,就可以连到你VPS上的transmission了 3BA35G http://blog.numino.net/ Transmission Remote GUI的下载地址: 0pLuws http://blog.numino.net/ http://transmisson-remote-gui.googlecode.com/files/transgui-2.2-setup.exe 13hRIS http://blog.numino.net/ 复制代码另外如果你用Android的手机,可以在菜市场搜索安装Transdroid,它可以很方便的在手机上管理transmission,也可以在手机上下载torrent,通过它传到vps的transmission里进行下载,非常方便 qEHbtO http://blog.numino.net/ 至此transmission在debian的安装就告一段落了,下来有时间我会写一下如何通过rss和irc自动下载torrent并传给transmission进行下载
|
|