扫描二维码关注官方公众号
返回列表 发布新帖

[其他] 迈拓Seagate MSS II NAS攻略大法之rtorrent篇

5112 0
发表于 2008-9-25 10:29:32 | 显示全部楼层 阅读模式

来吧兄弟,一起玩一起讨论!

您需要 登录 才可以下载或查看,没有账号?注册

×
rtorrent介绍

本来我打算就在mss上装mldonkey,这个软件既可以BT,又可以电驴,不过我装上这个软件后,发现很多BT的种子无法下载。现在下载电影什么基本还是bt,所以我就只能装rtorrent专门BT下载。

在mss上能跑的BT软件不少,不过应该这个是最好的,功能最全,支持不少新的功能。bt的下载速度可以达到windows的水平。

类似的软件,其实都有一个共同的特点,你可以通过web去控制,也可以通过windows的专门的客户端去控制。这两种方式你都可以实现远程控制,监控bt的下载。

关于乱码,我刚发现原来mss上自带的samba,就是3.02,你可以在命令行下查看,我这里就是在命令行下是乱码,在windows看到的都是正常,看来在mss上配置应该比在ddwrt等上配置简单不少。

# /usr/local/samba/sbin/smbd -V
Version 3.0.2


安装rtorrent 和相关软件




ipkg update

ipkg instal rtorrent

ipkg install screen

ipkg install lighttpd

ipkg install openldap-libs

mkdir /opt/share/torrent/session

# ln -s /opt/share/torrent/ /shares/mss-hdd/Public/downloads/

备注

1:缺省的下载路径是/opt/share/torrent/,我没有修改他的路径,只是做了一个链接,由于/opt/share/torrent/ 下缺少session文件夹,所以我创建一个。

2:如果不安装openldap-libs,你启动lighttpd会报错,可以参考底下的详细说明


配置rtorrent.conf 文件

当你装完rtorrent后,就会在/opt/etc/rtorrent.conf ,这是rtorrent的配置文件,我们需要修改这个文件,并把这个文件复制到/opt/root 目录下,并改名为.rtorrent.rc 。有一点需要注意的,在linux下修改配置文件,最好都是先做备份。

运行下面的命令

cd /

cp /opt/etc/rtorrent.conf /opt/etc/rtorrent.conf_backup

cp /opt/etc/rtorrent.conf /opt/root/.rtorrent.rc

vi /opt/root/.rtorrent.rc

编辑.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 = 15

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

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

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

# 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 = 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 = /opt/share/torrent/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 = 6890-6999

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

# 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 = on

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

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

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


encoding_list = UTF-8
umask = 0000
#scgi_port = :5000

scgi_port = localhost:5000

#scgi_local = /opt/var/run/rpc.socket
##############################


修改lighttpd.conf文件

vi /opt/etc/lighttpd/lighttpd.conf

首先在server.modules中加入一行


server.modules              = (
#                               "mod_rewrite",
#                               "mod_redirect",
#                               "mod_alias",
                                "mod_access",
#                               "mod_cml",
#                               "mod_trigger_b4_dl",
#                               "mod_auth",
#                               "mod_status",
#                               "mod_setenv",
#                               "mod_fastcgi",
#                               "mod_proxy",
#                               "mod_simple_vhost",
#                               "mod_evhost",
#                               "mod_userdir",
#                               "mod_cgi",
#                               "mod_compress",
#                               "mod_ssi",
#                               "mod_usertrack",
#                               "mod_expire",
#                               "mod_secdownload",
#                               "mod_rrdtool",
                               "mod_accesslog",
                                "mod_scgi")     


注意红色就是添加的。

在lighttpd.conf的最后加上
################

scgi.server = (
"/RPC2" =>
( "127.0.0.1" =>
(
"host" => "127.0.0.1",
"port" => 5000,
"check-local" => "disable"
)
)
)

##################



运行rtorrent

这个时候,你就可以在telnet到mss上运行直接运行rtorrent,不过有一点需要注意的,如果你关闭telnet的窗口,那么rtorrent也就停止了。所有你需要screen这个软件。

screen是个窗口管理器,在screen中运行的程序可以进入后台运行(进入后台后就可以关闭telnet,但是程序仍然在运行),并且可以随时调回前台,所以玩路由器或NAS的这个工具是必须要掌握的,非常有用哦!!

使用screen
在telnet中输入screen回车,将看到一大堆英文,这个时候再按一次回车,将进入一个新的screen窗口我简称之为窗口1,此时运行你想要的程序例如rtorrent,然后按Ctrl+A,D(这个代表按住Ctrl不放按A,然后松开手按D),就能使这个screen窗口1进入后台运行,这个时候即使关了telnet都是可以的,rtorrent仍然在后台运行,以后如果我想再回到窗口1,只要重新telnet连上路由,运行screen -r即可,你就又回到了窗口1了,用类似的方法你还可以开启窗口2,窗口3等等,这里就不介绍了,如果你有兴趣可以google搜索“linux screen 用法”

我们只要用screen将rtorrent放入后台运行,然后往监视目录中放种子文件就能完成下载,非常轻松哦,要查看状态,就telnet连上路由,然后screen -r即可,最高效的用法!!

重启服务

重启rtorrent和lighttpd
/opt/etc/init.d/S80lighttpd stop
/opt/etc/init.d/S80lighttpd start

killall rtorrent

启动rtorrent,就要用screen来启动
rtorrent

开机启动rtorrent

编辑/opt/etc/init.d/S99local

添加下面这一行就可以,

/opt/bin/screen -d -m /opt/bin/rtorrent -n -o import=/opt/root/.rtorrent.rc


在windows上安装rtorrent客户端管理程序

http://ntorrent.googlecode.com/f ... in-0.5-beta-win.zip


现在是这个版本了。下载回来后,运行ntorrent,

(可能是我机器已经安装java运行库,没有提示需要这个。

protocol : http/ssh
host : MSS的IP
port : 8081 (可以在/opt/etc/lighttpd/lighttpd.conf中修改成其他的,默认是这个)
mountpoint : /RPC2
最底下用户名和密码不填(如果你选择ssh,那么你就需要输入root的用户名和密码),点save然后点connect,如果能连上就可以使用ntorrent远程控制了

修改文件夹的权限

我通过链接的方式,把torrent的文件夹链接的到public的文件夹下,省去了修改配置文件里路径。不过产生了一个新的文件,就是这些文件夹,你在windows下,无法删除和写入文件,原因就和linux的权限有关。

解决的办法两个

1:修改配置文件,把路径指向public的文件夹,你在windows下,在public下建立相应的文件夹。

2:就是修改文件夹的权限,你可以通过winscp登陆mss,把torrent下的文件夹的权限有0755,全部都改为0777。这样就可以了,linux下用命令 chmod 777 目录。


备份配置文件

linux的配置,其实就是修改配置文件,把运行良好的配置文件备份下来,以后安装调试就好办多了。我的习惯是在/public/downloads/mss/config 把所有的配置文件都放在这个文件夹下。

# cp /opt/root/.rtorrent.rc /shares/mss-hdd/Public/downloads/mss/config/backup.rtorrent.rc
# cp /opt/etc/lighttpd/lighttpd.conf /shares/mss-hdd/Public/downloads/mss/config/backup.lighttpd.conf
# cp /opt/etc/vsftpd.user_list /shares/mss-hdd/Public/downloads/mss/config/backup.vsftpd.user_list
# cp /opt/etc/init.d/S99local //shares/mss-hdd/Public/downloads/mss/config/backup.S99local



要注意的问题

1:下载的路径,缺省都是指向/opt/share/torrent, 我没有修改他的路径,而且通过link的命令,做了一个链接,链接到public/downloads 目录下,我觉得这样会更加简单些。

2:这个配置文件是我目前用的配置文件,我是2m的adsl,大家可以参考,详细的解析,大家可以看恩山论坛,我是参考那里修改的,但是有个地方不太一样,scgi_port = localhost:5000,这个是和客户端远程管理相关,我使用恩山论坛的参数会出现这个错误:the response could not be parsed

3:lighttpd这个文件的修改,我也是和恩山论坛的那个贴有点不太一样的,就是后面增加的部分。

4:rotrrent还有一个功能,你可以把bt的文件直接放到rtorrent的目录下,他就会自动下载。

5:要提高下载速度,还必须在router里做端口映射,具体的端口,就是在配置文件里指定的,port_range = 6890-6999

6:rtorrent的远程管理其实可以不安装lighttpd,通过ssh进行远程连接,因为我们本身就安装了dropbear,所以你设置rtorrent通过ssh远程连接就可以了,我已经测试过,没有问题。

7:关于乱码的问题,目前我这里只是telnet上去运行rtorrent出现乱码,在windows下访问共享都是正常的,在客户端上也是正常的。这个估计和mss自带的samba就是3.02.

8:通过screen,可以在后台运行,如果mss重新启动,那么还是需要登陆mss上运行rtorrent,开机就启动rtorrent,开始下载的方案是:修改S99local,添加一行

/opt/bin/screen -d -m /opt/bin/rtorrent -n -o import=/opt/root/.rtorrent.rc


8:lighttpd这个是用来做rtorrent管理用的,装这个的时候会出现下面的错误

tarting web server: lighttpd
2008-04-08 09:58:55: (plugin.c.165) dlopen() failed for: /opt/lib/lighttpd/mod_auth.so File not found
2008-04-08 09:58:55: (server.c.622) loading plugins finally failed
Successfully terminated.

这个错误的解决办法就是你需要再安装一个包就可以解决了

# ipkg list | grep openldap-libs
openldap-libs - 2.3.38-1 - Open Lightweight Directory Access Protocol
# ipkg install openldap-libs
Installing openldap-libs (2.3.38-1) to root...
Downloading http://ipkg.nslu2-linux.org/feed ... 2.3.38-1_mipsel.ipk
Installing libdb (4.2.52-3) to root...
Downloading http://ipkg.nslu2-linux.org/feed ... 4.2.52-3_mipsel.ipk
Installing gdbm (1.8.3-2) to root...
Downloading http://ipkg.nslu2-linux.org/feed ... _1.8.3-2_mipsel.ipk
Installing cyrus-sasl-libs (2.1.22-2) to root...
Downloading http://ipkg.nslu2-linux.org/feed ... 2.1.22-2_mipsel.ipk
Configuring cyrus-sasl-libs
Configuring gdbm
Configuring libdb
Configuring openldap-libs
Successfully terminated.
这个时候,你启动lighttpd,就没有问题了

9:我装完rtorrent,我所安装的软件,这些软件一部分是我安装的,一部分是optware里带的。下次记录一下optware里的软件,这样就可以知道系统装了多少软件了。经常出现不同的报错,很多情况下都是因为你的环境不太一样。

# ipkg list_installed
amule - 2.1.3-10 -
busybox - 1.5.0-1 -
busybox-base - 1.5.0-1 -
busybox-links - 1.5.0-1 -
cyrus-sasl-libs - 2.1.22-2 -
expat - 2.0.1-1 -
fontconfig - 2.3.2-5 -
freetype - 2.1.10-4 -
gconv-modules - 2.2.5-7 -
gdbm - 1.8.3-2 -
libcurl - 7.16.4-1 -
libdb - 4.2.52-3 -
libgd - 2.0.35-1 -
libjpeg - 6b-2 -
libpng - 1.2.19-1 -
libsigc++ - 2.0.18-1 -
libtorrent - 0.12.0-2 -
libuclibc++ - 0.2.2-4 -
libxml2 - 2.6.31-1 -
lighttpd - 1.4.19-3 -
ncurses - 5.6-1 -
ncursesw - 5.6-2 -
openldap-libs - 2.3.38-1 -
openssl - 0.9.7m-2 -
pcre - 7.6-2 -
readline - 5.2-2 -
rtorrent - 0.8.0-1 -
screen - 4.0.3-2 -
termcap - 1.3.1-2 -
uclibc-opt - 0.9.28-12 -
wget - 1.10.2-4 -
wxbase - 2.8.0-5 -
xmlrpc-c - 1.11.00-2 -
zlib - 1.2.3-2 -
Successfully terminated.

来自:http://hi.baidu.com/chenshake/bl ... f74ec7d46225e4.html

回复

懒得打字嘛,点击右侧快捷回复 【本站酷狼4T,750元】
您需要登录后才可以回帖 登录 | 注册

本版积分规则

投诉/建议联系

support@gebi1.cn

未经授权禁止转载,复制和建立镜像,
如有违反,追究法律责任
  • 关注公众号
  • 添加微信客服
Copyright © 2001-2024 隔壁网 版权所有 All Rights Reserved. 粤ICP备14056481号-1
关灯 在本版发帖
扫一扫添加微信客服
返回顶部
快速回复 返回顶部 返回列表