RTorrent
rTorrent 是一个非常简洁、优秀、非常轻量的BT客户端. 它使用了 ncurses 库以 C++ 编写, 因此它完全基于文本并在终端中运行. 将 rTorrent 用在安装有 GNU Screen 和 Secure Shell 的低端系统上作为远程的 BT 客户端是非常理想的。
安装[编辑 | 编辑源代码]
你也可以从 AUR 中安装 rtorrent-gitAUR 或 rtorrent-extendedAUR[损坏的链接:package not found]。
配置[编辑 | 编辑源代码]
在运行 rTorrent 前,首先要创建默认配置文件,该文件可以从 /usr/share/doc/rtorrent/rtorrent.rc
上找到,并将其另存为 .rtorrent.rc
放到你的主目录中.
$ cp /usr/share/doc/rtorrent/rtorrent.rc ~/.rtorrent.rc
保存后, 使用你喜爱的文本编辑器打开它并进行有必要的改动. 可以简单地去掉那些你需要使用的选项的注释, 如需更详细的资料,请访问rTorrent Common Tasks
性能优化[编辑 | 编辑源代码]
下面这些配置的值主要取决于你的系统和网络速度. 要寻找最佳配置,请访问下面网站并按照指示操作: 优化 BitTorrent 下载速度
# 每个种子所允许的最大最小连接数 #min_peers = 40 max_peers = 52 # 同上,针对的是已经完成的种子 (-1 表示和下载中的种子一致) #min_peers_seed = 10 max_peers_seed = 52 # 每个种子的最大同时上传数 max_uploads = 8 # 全局的上传与下载速度限制(以 KB 为单位),“0”表示无限制 download_rate = 200 upload_rate = 28
check_hash
选项将在下载完成或 rTorrent 重新启动时对文件进行 Hash 校验。这将确保你获得/做种的文件没有错误:
check_hash = yes
创建和管理文件[编辑 | 编辑源代码]
directory
选项将决定你的 torrent 数据被保存在哪. 如果你想改变默认保存目录,请务必输入正确的绝对路径; rtorrent 有一个奇怪的 Bug,一些时候它不考虑相对路径(如 ~/torrents):
directory = /home/[user]/torrents/
session
选项将允许 rTorrent 保存你的 torrents 的进度. 一定要创建一个会话目录 .session
(普通用户运行:$ mkdir ~/.session
):
session = /home/[user]/.session/
schedule
选项将使 rTorrent 监视一个特定目录中的 .torrent 文件。使用这一选项时一定要小心,这将移动 .torrent 文件到你的会话目录下,并将之重命名为其 Hash 值。 当你看到了一个你想要下载的种子文件,你可以使用你的浏览器将这一种子文件保存到这一监视目录下, rTorrent 将会自动的开始下载这一种子文件的内容。必须确保要监视的目录已经被创建(以普通用户身份执行: mkdir ~/watch):
# 监听目录中的新的种子文件,并停止那些已经被删除部分的种子 #schedule = watch_directory,5,5,load_start=./watch/*.torrent #schedule = untied_directory,5,5,stop_untied= schedule = watch_directory,5,5,load_start=/home/[user]/watch/*.torrent schedule = untied_directory,5,5,stop_untied= schedule = tied_directory,5,5,start_tied=
下面的 schedule
选项将使 rTorrent 在磁盘空间不足时停止。 这对于Seedbox这种磁盘空间非常有限的设备来说是很有用的。按照你的喜好来改变下面的数值:
# 当磁盘空间不足时停止下载 schedule = low_diskspace,5,60,close_low_diskspace=100M
端口配置[编辑 | 编辑源代码]
port_range
选项将指定选用哪一个端口去侦听。建议使用高于 49152 的端口。虽然 rTorrent 允许使用多个的端口,还是建议使用单个的端口。
port_range = 49164-49164
Additionally, make sure port forwarding is enabled for the proper port(s) (see: Port Forward Guides).
附加设置[编辑 | 编辑源代码]
encryption
选项使能加密功能。 使用加密功能十分重要not only for yourself, but also for your peers in the torrent swarm. 人们也许需要对它们的网络提供商模糊其带宽使用。即使你不需要这些保护,开启加密也不会对你有所负作用。详细信息请见: Bittorrent Protocol Encryption
# 加密选项,设为0(默认情况)或下面的任何一个: # allow_incoming, try_outgoing, require, require_RC4, enable_retry, prefer_plaintext # # 如下例中的值将允许将接入连接加密,开始时以非加密方式作为连接的输出方式, # 如行不通则以加密方式进行重试,在加密握手后,优先选择将纯文本以 RC4 加密 # # encryption = allow_incoming,enable_retry,prefer_plaintext encryption = allow_incoming,try_outgoing,enable_retry
下面的选项用以加入 DHT 支持。如果你使用了 public trackers,你可能希望使能 DHT 以获得更多的连接。如果你仅仅使用了私有的连接,请不要使能 DHT,因为这将降低你的速度,并可能造成一些隐密的危险。一些私有连接甚至会就使用 DHT 而向你发出警告。
# 使能对 trackerless torrents 或当所有的 tracker 都停止情况下的 DHT 支持。 # 可以被设置为 "disable" (完全禁止 DHT),“off“(不启动 DHT), "auto"(按需要启 # 动或停止 DHT)或者 "on" (即时开启 DHT)。 # 默认设置为 "off"。要使 DHT 工作,会话目录必须被定义。 # # dht = auto # UDP 使用 UHT的端口 # # dht_port = 6881 # 使能 peer 的交换 (对那些没有被标记为私有的 torrent) # # peer_exchange = yes
管理[编辑 | 编辑源代码]
Cmd | Action |
---|---|
Ctrl-q | Quit application |
Left | Returns to the previous screen |
Right | Goes to the next screen |
Backspace | Adds the specified *.torrent |
rTorrent依靠用户输入的专有的快捷键.可在官方网站上查看完整的: rTorrent用户指南
Ctrl-q
两次会使得 rTorrent 关闭,而不会等待向连接的 tracker 发送停止声明。这里是一些最基础的快速参考:
- Control-q : closes rTorrent, done twice makes the program shutdown without waiting to send stopping information to the trackers.
- Left arrow : returns to the previous screen.
- Right arrow : goes to the next screen.
- a|s|d : increase global upload throttle about 1|5|50 KB/s
- A|S|D : increase global download throttle about 1|5|50 KB/s
- z|x|c : decrease global upload throttle about 1|5|50 KB/s
- Z|X|C : decrease global download throttle about 1|5|50 KB/s
- Control-S : starts download
- Control-D : stops an active download, removes a stopped download.
- + or - : changes the download priority of selected torrent.
- Backspace : adds the specified .torrent. After pressing this button write full path or URL of .torrent file. You can use Tab and other tricks from bash.
Redundant mapping[编辑 | 编辑源代码]
Ctrl-s
is often used for terminal control to stop screen output while Ctrl-q
is used to start it. These mappings may interfere with rTorrent. Check to see if these terminal options are bound to a mapping:
$ stty -a
... swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; ...
To remove the mappings, change the terminal characteristics to undefine the aforementioned special characters (i.e. stop
and start
):
# stty stop undef # stty start undef
To remove these mappings automatically at startup you may add the two preceding commands to your ~/.bashrc
file.
通过Screen使用rTorrent[编辑 | 编辑源代码]
Screen 是允许CLI应用程序在后台运行并支持X运行的一个程序.
安装:
pacman -S screen
然后复制screenrc到你的用户主目录:
cp /etc/screenrc ~/.screenrc
要总是通过Screen来运行rTorrent,在.screenrc文件中添加以下内容:
screen -t rtorrent rtorrent
要运行screen和rTorrent, 只要简单的在终端运行screen就可以了. Control-a followed by d will detach screen, and running screen -r will open screen again.
On a remote machine[编辑 | 编辑源代码]
Most setups of rTorrent on a remote machine involve using Screen. Supposing you have a detached Screen session with rtorrent on the remote machine (and the option to SSH into it), you can gain access to it using:
/usr/bin/ssh -t -p <ssh port on remote machine> <user>@<remote machine> screen -RD
If you want immediate access on startup, you will need to upload a key from your machine to remote host (so you will not be prompted for a password) and setup a terminal to run the command above. An inittab example using rungettyAUR[损坏的链接:package not found] on virtual console 4:
sam:45:respawn:/sbin/rungetty tty4 -u <local user> -- /usr/bin/ssh -t -p <ssh port on remote machine> <remote user>@<remote machine> screen -RD
Screen后台运行rTorrent[编辑 | 编辑源代码]
I use this on my home server to run rtorrent w/ screen as a daemon. With the username rtorrent Just create an rtorrent file in your /etc/rc.d/ and add the following code.
#!/bin/bash . /etc/rc.conf . /etc/rc.d/functions case "$1" in start) stat_busy "Starting rtorrent" su rtorrent -c 'screen -d -m rtorrent' &> /dev/null if [ $? -gt 0 ]; then stat_fail else add_daemon rtorrent stat_done fi ;; stop) stat_busy "Stopping rtorrent" killall -w -s 2 /usr/bin/rtorrent &> /dev/null if [ $? -gt 0 ]; then stat_fail else rm_daemon rtorrent stat_done fi ;; restart) $0 stop sleep 1 $0 start ;; *) echo "usage: $0 {start|stop|restart}" esac exit 0
On a remote computer I use the following script to connect to the server's daemon process:
ssh -t rtorrent@192.168.1.10 'screen -r'
其他提示[编辑 | 编辑源代码]
- To use rTorrent with a tracker that uses https, do the following as root:
cd /etc/ssl/certs wget --no-check-certificate https://web.archive.org/web/20160505025153/https://www.geotrust.com/resources/root_certificates/certificates/Equifax_Secure_Global_eBusiness_CA-1.cer mv Equifax_Secure_Global_eBusiness_CA-1.cer Equifax_Secure_Global_eBusiness_CA-1.pem c_rehash
And from now on run rTorrent with:
rtorrent -o http_capath=/etc/ssl/certs
Be sure to change .screenrc to reflect this change if you use screen:
screen -t rtorrent rtorrent -o http_capath=/etc/ssl/certs
- To create .torrent files, I recommend mktorrent包 for commandline interface or RubyTorrent for GUI.
Send Text Message Upon Torrent Completion Using GMail[编辑 | 编辑源代码]
Cell phone providers allow you to "email" your phone:
Verizon: 10digitphonenumber@vtext.com Former AT&T customers: 10digitphonenumber@mmode.com Sprint: 10digitphonenumber@messaging.sprintpcs.com T-Mobile: 10digitphonenumber@tmomail.net Nextel: 10digitphonenumber@messaging.nextel.com Cingular: 10digitphonenumber@cingularme.com Virgin Mobile: 10digitphonenumber@vmobl.com Alltel: 10digitphonenumber@alltelmessage.com OR 10digitphonenumber@message.alltel.com CellularOne: 10digitphonenumber@mobile.celloneusa.com Omnipoint: 10digitphonenumber@omnipointpcs.com Qwest: 10digitphonenumber@qwestmp.com
If you have Verizon, your cell phone's "email" is 5551234567@vtext.com
- Install Heirloom's mailx program:
pacman -S mailx-heirloom
- Clear the /etc/nail.rc file and enter:
set smtp=smtp.gmail.com:587 set smtp-use-starttls set ssl-verify=ignore set ssl-auth=login set smtp-auth-user=USERNAME@gmail.com set smtp-auth-password=PASSWORD
Now to send the text, we must pipe a message to the mailx program.
- Make a bash script (/path/to/mail.sh):
echo "Torrent Done" | mailx 5551234567@vtext.com
- And finally, add the important ~/.rtorrent.rc line:
on_finished = move_complete,"execute=/path/to/mail.sh"
Note: The "move complete" will not affect anything. I could not get it to work without it.
See Also[编辑 | 编辑源代码]
A Detailed Intro to Bittorrent including definition of terms terms