rtorrent

torrent的安装网上一大堆文章,不过这里还是简要说明一下如何来安装rtorrent:
最简单的方式莫过于二进制安装:sudo apt-get install rtorrent,一切ok。
不过,你也可以选择源码包安装,可以sudo apt-get source rtorrent得到rtorrent源码包,
然后再configure、make、sudo makeinstall,不过期间可能会提示你libtorrent没安装,这是因为rtorrent是依赖libtorrent的,所以得先安装libtorrent。。。这就是源码包安装的不方便之处,依赖关系得自己处理,但是源码包安装也有好处,可以自己加一些额外的配置选项。好了,安装就不多说了,有问题g一下基本可以解决。

安装完之后,在使用前还需要一个东西,就是rtorrent的配置文件。rtorrent的配置文件官方是不带的,所以只能自己写。配置文件默认名叫做.rtorrent.rc,放在宿主目录下。具体.rtorrent.rc的内容可以参考我的:

#最小允许peer数
min_peers = 3
#最大允许peer数
max_peers = 100
#最大同时上传用户数
max_uploads = 10
#最大下载950k/s 光纤用户使用,adsl请酌情修改
download_rate = 950
#最大上传200k/s 光纤用户使用,adsl请酌情修改
upload_rate = 200
# 下载目录
directory = /home/xulei/filedownload/downloads

# 下载历史目录(此目录中包括下载进度信息和DHT节点缓存)
session = /home/xulei/filedownload/session

# Keeps session data files even if torrent has finished
session_on_completion = yes
# Not really required, but recommended - see rtorrent(1) man page
session_lock = yes
# Setup A: Run through CRON
# Save session data every 5 mins, with a 4 min offset
schedule = session_save,240,300,session_save=
#(配置自动监视,把bt种子扔进~/universe目录就自动下载)
schedule = watch_directory,5,5,load_start=/home/xulei/filedownload/torrent


#硬盘空间低于100M就自动停止一切下载)
schedule = low_diskspace,5,60,close_low_diskspace=100M
#(在总上传量达到200M的情况下上传/下载率达到200%,或者在总上传量不足200M情况下上传/下载率达到2000%,则停止上传)
schedule = ratio,60,60,"stop_on_ratio=200,200M,2000"
# Enable the default ratio group.
# ratio.enable=
# Change the limits, the defaults should be sufficient.
#ratio.min.set=100
#ratio.max.set=300
#ratio.upload.set=50M
# Changing the command triggered when the ratio is reached.
#system.method.set = group.seeding.ratio.command, d.close=, d.erase=
#bt监听端口
port_range = 9400-9500
#随机从上面范围内选择端口
port_random = yes
# 是否使用UDP trackers,建议选yes
use_udp_trackers = yes
######开启DHT######
dht = on
#DHT所用的UDP端口
dht_port = 9501
#种子交换功能
peer_exchange = yes
#(上传缓存,每个种子10M,小内存用户请酌情修改)
send_buffer_size = 10M
#(下载缓存,每个种子20M,小内存用户请酌情修改)
receive_buffer_size = 20M
#(修改编码以避免中文乱码)
encoding_list=UTF-8
上面红色的为比较重要的部分,可根据自己情况更改,其他的基本保持不变就行。
直接运行rtorrent命令就可以运行rtorrent了,可以把一些torrent种子文件放在刚设置的rtorrent监视目录中,这样rtorrent就能自动根据这些种子下载了。
关于rtorrent的使用,
RTorrentUserGuide
上面讲的比较详细,这里不再赘述。
其实个人认为rtorrent还是挺好用的,速度不错,操作也比较便捷。而且还有很多优点,诸如:

  • 支持协议加密,防止ISP封BT
  • 支持peer交换,客户端之间交换peer,让每个客户可以连上更多的客户
  • 支持多Tracker协议, UDP Tracker
  • 支持选择文件下载,以及调整下载优先级
  • 支持通过DHT网络实现无种下载
  • 支持快速恢复(Fast Resume),下载中断后无需重新hash,节约时间
  • 支持nTorrent(windows)远程控制


参考资料:
rtorrent速度之王:
http://blog.chinaunix.net/u/17248/showart_673200.html

rtorrent user guide:
http://libtorrent.rakshasa.no/wiki/RTorrentUserGuide



快捷键、

1. 方向鍵 : ↑,↓,←,→
2. Torrent 開始下載 : Ctrl + S (Screen下用法為: Ctrl+ a + s)
3. Torrent 暫停下載 : Ctrl + D
4. Torrent 停止下載 : Ctrl + K
5. 清除Torrent下載列表 : [法1] 在停止狀態使用Ctrl + D, [法2] 在下載完成連續執行 Ctrl+D 二次
6. 限定最大上傳速度 : [增加]a / s / d [減少] z / x /c
7. check file hash : Ctrl + R
8. 離開rtorrent程式 : Ctrl+ q (Screen下用法為 : Ctrl+ a + q)




注意了:
rtorrent不支持写入文件到ntfs分区, 只能用ext, fat32等非ntfs之类, 这个一直是rtorrent没有fix的一个bug:
http://libtorrent.rakshasa.no/ticket/226
因此如果实在是没有非ntfs分区作为下载目录的话,就不要考虑用了。期待新版本能解决这个问题。


sudo apt-get install后,发现居然是个命令行的,一上来就懵了完全不会用。
于是上官网,查看user guide http://libtorrent.rakshasa.no/wiki/RTorrentUserGuide

快速扫了一遍,得到了以下的几个有用的命令提示:

引用

General note about key combinations: ^ means the Ctrl-key. M-x means Meta-x (Usually Alt-x or Esc-x)
    Adding and removing torrents
    backspace Add torrent using an URL or file path. Use tab to view directory content and do auto-complete. Also, wildcards can be used. For example: ~/torrent/*
    return Same as backspace, except the torrent remains inactive. (Use ^s to activate)
    ^o Set new download directory for selected torrent. Only works if torrent has not yet been activated. 选择下载目录
    ^s Start download. Runs hash first unless already done. 开始下载
    ^d Stop an active download, or remove a stopped download.暂停下载
    ^r Initiate hash check of torrent. Without starting to download/upload.

    Throttling
    a/s/d Increase the upload throttle by 1/5/50 KB.
    z/x/c Decrease the upload throttle by 1/5/50 KB.
    A/S/D Increase the download throttle by 1/5/50 KB.
    Z/X/C Decrease the download throttle by 1/5/50 KB.

    Note that all throttling is applied globally and not per torrent.

根据以上这些信息,先按^o设定一下下载目录,再按"backspace",在load-start>提示符下,输入torrent的路径,这时就能看到下载任务已经添加到了列表中,需要再按一下ctrl+s 开始, 暂停是ctrl+d, 暂停时再按ctrl+d则会删除该任务(注意:连同种子文件也会删除的)。有一点要注意,就是ctrl+s一定要先用键盘向右方向键先选择下载的任务之后才有效,不然总会说command mis type... 这个问题让我郁闷了半天。通过a/s/d可以增加上传限速,而A/S/D则是增加下载限速。
如果需要选择文件下载, 则选择了下载任务情况下,再按右方向键, 上下键选择filelist,再向右在不需要的文件上按空格,将优先级设置为off则是放弃下载。有一个快捷键没有说到,就是ctrl+k,关闭任务但不删除。这个快捷键是我后来发现的,假设是这个情况会用到:当你开始了一个下载任务,但又要更改下载目录的时候,可以现关闭再ctrl+o。
以上是基本设置, 根据这些已经跟普通的bt下载软件差不多了,一般性的使用可以参考 http://discuz.orz101.com/viewthread.php?tid=263&extra=page%3D1

刚才一定会发现启动rtorrent,提示文件.rtorrent.rc找不到,而我在本地找了个遍都没有找到。后来才发现这个文件直接安装是不带的,要从官网上下载,而这个文件正是rtorrent的配置文件, http://libtorrent.rakshasa.no/browser/trunk/rtorrent/doc/rtorrent.rc?rev=latest
发现如果浏览官网的wiki是能够看到一项:rtorrent.rc example的,点进去发现链接跟上面的一样。wiki提供的信息比较全面, 远比直接从主页进user guide看到的多。把这个rtorrent.rc的内容复制下来,在本地的/home/yourhome目录下创建.rtorrent.rc文件,再把复制的内容粘贴进去。里面的设置一目了然,做了设定之后,重启rtorrent即能生效。

刚试用rtorrent的时候,感觉速度提不上来, 比起奔流有些差距(奔流一般我都能有200k/s up的下载速度,但是rtorrent开了半个小时,平均也就40-50k/s);后来看到网上很多人说要开dht,不支持dht的bt下载软件形同鸡肋,于是又到wiki上查看关于dht的设置:
引用

    # Enable DHT support for trackerless torrents or when all trackers are down.

    # May be set to "disable" (completely disable DHT), "off" (do not start DHT),

    # "auto" (start and stop DHT as needed), or "on" (start DHT immediately).

    # The default is "off". For DHT to work, a session directory must be defined.

    #

    # dht = auto# UDP port to use for DHT.

    #

    # dht_port = 6881

取消以上关于dht的注释即可,而默认确实是关闭dht的。再试试看下载的速度, 这下居然能够到500kup了,威力巨大阿。
到这里,速度上已经让我满意了。

再看看rtorrent.rc中还有没有比较实用的设置:
引用

    # Default directory to save the downloaded torrents.
    directory =/home/lynn/bt
    directory指定了下载文件的存放目录。

    # Default session directory. Make sure you don't run multiple instance
    # of rtorrent using the same session directory. Perhaps using a
    # relative path?
    session =/home/lynn/bt/session
    session指定session的存放目录,有了它就能进行恢复下载。不然每次重启都要手动添加。

    # Watch a directory for new torrents, and stop those that have been
    # deleted.
    schedule = watch_directory,5,5,load_start=/home/lynn/bt/watch/*.torrent
    schedule = untied_directory,5,5,stop_untied=
    这两项启动了rtorrent的监视功能,将种子文件放入load_start指定的目录中后,rtorrent将自动开始下载。

    # example: stop at ratio 2.0 with at least 200 MB uploaded, or else ratio 20.0
    schedule = ratio,60,60,"stop_on_ratio=2000,200M,2000"
    可以设置上传和下载达到一定比例后停止,大概这里的比例是百分之一为单位,所以2000就等于20倍

    我的locale是zh_CN.UTF-8的因此我在配置文件中添加了下面一行,这样生成的目录和文件名就不是乱码了。
    encoding_list=UTF-8

另外,还找到一篇文章,说得很全面,以上设置的部分内容取自这里:
[url]http://www.cublog.cn/u/17248/showart_673200.html [/url]

经过自己的试用,发现rtorrent小巧、功能强大, 监视种子开始新下载功能更是一个新颖又实用的地方,更难得的是速度很快,已经没有必要眷念windows下的bt下载软件,别扭的用wine+utorrent了, 作为linux的bt下载又多了一个不错的选择。

适合本机的rtorrent 的.rtorrent.rc

# This is an example resource file for rTorrent. Copy to
# ~/.rtorrent.rc and enable/modify the options as needed. Remember to
# uncomment the options you wish to enable.

# Minumum amount of peers to connect per torrent, if available.
min_peers = 40

# Minumum amount of peers to connect per torrent.
max_peers = 250

# Same as above but for seeding completed torrents (-1 = same as downloading)
min_peers_seed = 10
max_peers_seed = 20

# Maximum number of simultanious uploads per torrent.
max_uploads = 5

# Global download rate in KiB. "0" for unlimited.
download_rate = 0

# Global upload rate in KiB. "0" for unlimited.
upload_rate = 20

# Default directory to save downloaded files. Note it doesn't support
# space yet.
# directory = /opt/share/torrent/work/
directory = /home/audered/rtorrentmenu/downloads

# Watch a directory for new torrents, and stop those that have been deleted.
#schedule = watch_directory,5,5,load_start=/opt/share/torrent/dl/*.torrent
schedule = watch_directory,5,5,load_start=/home/audered/rtorrentmenu/torrent/*.torrent
schedule = untied_directory,5,5,stop_untied=

# Close torrents when diskspace is low.
schedule = low_diskspace,5,60,close_low_diskspace=100M

# Default session directory. Make sure you don't run multiple instance
# of rtorrent using the same session directory. Perhaps using a
# relative path?
session = /home/audered/rtorrentmenu/session

# The ip address reported to the tracker.
#ip = rakshasa

# The ip address the listening socket and outgoing connections is
# bound to.
#bind = rakshasa

# Port range to use for listening.
port_range = 51777-51780

# Start opening ports at a random position within the port range.
port_random = yes

# Check hash for finished torrents. Might be usefull until the bug is
# fixed that causes lack of diskspace not to be properly reported.
#check_hash = no

# Set whetever the client should try to connect to UDP trackers.
use_udp_trackers = yes

# Alternative calls to bind and ip that should handle dynamic ip's.
#schedule = ip_tick,0,1800,ip=rakshasa
#schedule = bind_tick,0,1800,bind=rakshasa

#
# Do not modify the following parameters unless you know what you're doing.
#

# Hash read-ahead controls how many MB to request the kernel to read
# ahead. If the value is too low the disk may not be fully utilized,
# while if too high the kernel might not be able to keep the read
# pages in memory thus end up trashing.
#hash_read_ahead = 10

# Interval between attempts to check the hash, in milliseconds.
#hash_interval = 100

# Number of attempts to check the hash while using the mincore status,
# before forcing. Overworked systems might need lower values to get a
# decent hash checking rate.
#hash_max_tries = 10

# Max number of files to keep open simultaniously.
#max_open_files = 128

# Number of sockets to simultaneously keep open.
#max_open_sockets = <no default>


# Example of scheduling commands: Switch between two ip's every 5
# seconds.
#schedule = "ip_tick1,5,10,ip=torretta"
#schedule = "ip_tick2,10,10,ip=lampedusa"

# Remove a scheduled event.
#schedule_remove = "ip_tick1"

# Stop torrents when reaching upload ratio in percent,
# when also reaching total upload in bytes, or when
# reaching final upload ratio in percent.
# example: stop at ratio 2.0 with at least 200 MB uploaded, or else ratio 20.0
#schedule = ratio,60,60,"stop_on_ratio=200,200M,2000"
schedule = ratio,30,60,stop_on_ratio=200


# Encryption options, set to none (default) or any combination of the following:
# allow_incoming, try_outgoing, require, require_RC4, enable_retry, prefer_plaintext
#
# The example value allows incoming encrypted connections, starts unencrypted
# outgoing connections but retries with encryption if they fail, preferring
# plaintext to RC4 encryption after the encrypted handshake
#
encryption = allow_incoming,enable_retry,prefer_plaintext

# Enable DHT support for trackerless torrents or when all trackers are down.
# May be set to "disable" (completely disable DHT), "off" (do not start DHT),
# "auto" (start and stop DHT as needed), or "on" (start DHT immediately).
# The default is "off". For DHT to work, a session directory must be defined.
#
 dht = auto

# UDP port to use for DHT.
#
 dht_port = 6881

# Enable peer exchange (for torrents not marked private)
#
 peer_exchange = yes

#
# Do not modify the following parameters unless you know what you're doing.
#


  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值