rtorrent的确非常好用,下载机使用了Ubuntu 9.10, openssh-server, rtorrent 0.8.6/libtorrent 0.12.0, DDNS, samba就OK了。
基本上rtorrent的编译非常简单,下载libtorrent和rtorrent(Ubuntu 9.10中的rtorrent版本太老,有一些配置没法支持,所以自己编译最新版本),然后就是configure --prefix=/usr, make, sudo make install。中途缺什么就apt-get什么就行了。注意rtorrent是用C++写的,所以要sudo apt-get install g++。
有一点预先提醒一下:rtorrent目前似乎对EXT4有点问题,所以还是用EXT3比较靠谱。特别是如果配置了下载完成之后mv到另外一个目录的话,问题会更多。
安装完成之后就是配置了,而配置rtorrent主要是这些方面:
1. 下载rtorrent官方提供的一个init脚本,可以用来放在/etc/init.d中,这样可以让rtorrent开机启动。这个脚本在rtorrent的官网上有下载,只需要修改user=这一项配置就可以了。将脚本改名成rtorrent,放到/etc/init.d下面,用sudo update-rc.d rtorrent defaults就可以开机启动了。这个脚本会使用screen将rtorrent放在后台运行,而这个screen的名字就是rtorrent,所以可以用screen -r rtorrent来切换到这个screen中。
2. 配置~/.rtorrent.rc,这个配置文件很讲究,看完了rtorrent网站上的所有文档之后,我的配置如下:
#
Super rtorrent configurations
# Directory structure
# ~/rtorrent
# --> session
# --> torrents -- put torrents for watching
# --> movie
# --> music
# --> game
# --> soft
# --> misc
# --> download -- put downloaded files
# --> movie
# --> music
# --> game
# --> soft
# --> misc
# --> working
# Session directory
session
=
/
home
/
download
/
rtorrent
/
session
#
Watch a directory for torrents, and set download destination dir to another
schedule
=
watch_directory_1
,
10
,
10
,
"
load_start=/home/download/rtorrent/torrents/movie/*.torrent,d.set_directory=/home/download/rtorrent/download/movie/
"
schedule
=
watch_directory_2
,
10
,
10
,
"
load_start=/home/download/rtorrent/torrents/music/*.torrent,d.set_directory=/home/download/rtorrent/download/music/
"
schedule
=
watch_directory_3
,
10
,
10
,
"
load_start=/home/download/rtorrent/torrents/game/*.torrent,d.set_directory=/home/download/rtorrent/download/game/
"
schedule
=
watch_directory_4
,
10
,
10
,
"
load_start=/home/download/rtorrent/torrents/soft/*.torrent,d.set_directory=/home/download/rtorrent/download/soft/
"
schedule
=
watch_directory_5
,
10
,
10
,
"
load_start=/home/download/rtorrent/torrents/misc/*.torrent,d.set_directory=/home/download/rtorrent/download/misc/
"
schedule
=
tied_directory
,
10
,
10
,
start_tied
=
schedule
=
untied_directory
,
10
,
10
,
close_untied
=
#
Global download/upload rate
# max_downloads_div = 90
# max_downloads_global = 5
download_rate
=
450
upload_rate
=
64
#
Bandwidth time control
schedule
=
throttle_1
,
00
:
00
:
00
,
24
:
00
:
00
,
download_rate
=
450
schedule
=
throttle_2
,
00
:
00
:
00
,
24
:
00
:
00
,
upload_rate
=
64
schedule
=
throttle_3
,
12
:
30
:
00
,
24
:
00
:
00
,
download_rate
=
200
schedule
=
throttle_4
,
12
:
30
:
00
,
24
:
00
:
00
,
upload_rate
=
10
schedule
=
throttle_5
,
13
:
30
:
00
,
24
:
00
:
00
,
download_rate
=
450
schedule
=
throttle_6
,
13
:
30
:
00
,
24
:
00
:
00
,
upload_rate
=
64
schedule
=
throttle_7
,
21
:
00
:
00
,
24
:
00
:
00
,
download_rate
=
200
schedule
=
throttle_8
,
21
:
00
:
00
,
24
:
00
:
00
,
upload_rate
=
10
#
Global connection
min_peers
=
40
max_peers
=
100
min_peers_seed
=
10
max_peers_seed
=
50
max_uploads
=
15
#
Default working directory
directory
=
/
home
/
download
/
rtorrent
/
working
/
#
Close downloading when disk space is low
schedule
=
low_diskspace
,
5
,
60
,
close_low_diskspace
=
500m
#
Ports for listening
port_range
=
6998
-
6999
#
Set whetever the client should try to connect to UDP trackers
use_udp_trackers
=
yes
#
Turn off DHT
dht
=
off
#
Enable peer exchange (for torrents not marked private)
peer_exchange
=
yes
#
Codepage settings
encoding_list
=
utf
-
8
#
Set buffer (10M & 20M)
# According to the codes, seems these options don't take effect
send_buffer_size
=
10485760
receive_buffer_size
=
20971520
这份配置中,几个关键点提一下:
1. 没有使用很多人都用的下载完成之后,mv到另外一个目录的做法。因为个人感觉没有必要,而且EXT4下会有问题。
2. max_downloads_global不是用来设置最多同时允许几个任务run的,这个配置其实是限制所有可用的下载连接数的。而全局的下载连接数是根据下载throttle会自动计算,所以还是不要配置max_downloads_global和max_downloads_div的为好。
3. 下载和上传的throttle一定要配置正确,因为这些数值同时也决定了下载和上传连接的数量,这样就不会导致连接数过高,从而导致内存占用大,adsl路由器出现断流。
4. rtorrent是没法配置同时允许的最大任务数的,正如第三点所说,没有这个必要,因为会根据下载和上传的throttle来自动配置。在网上看到很多人利用torrent watch+cron的方式来间接实现了,其实个人感觉也是没有必要。因为throttle会限制全局下载连接数,所以就算丢进去一大堆任务,问题也不大,因为连接数被限制住了。
5. 根据时间来调整throttle很实用。比如晚上上网的时候限速,白天的时候一小段时间限速(这是因为这段时间是公司的休息时间,可以利用这段时间在公司查看下载状况,还可以添加任务,如果下载不限速,那由于连接数很多,所以在公司就很难连上下载机)。需要注意的是,不能只调节下载速度,上传速度也要调节。否则由于上传速度太高,上传连接都被占满,这样的话,也会导致远程ssh非常的慢。