找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
广告投放联系QQ68610888
查看: 3901|回复: 1

WRTSL54GS动手玩 之 DD-WRT篇 2/3

[复制链接]
本帖最后由 myeyre 于 2009-10-15 23:16 编辑

原文链接, 请大家指教:
http://hi.baidu.com/myeyre/blog/ ... 98ebf1431694b3.html

恩山一次贴不下, 分三次, 第二次:

2) 脱机下载: 如何养驴或BT

BT:
Transmission:
参照: http://www.dd-wrt.com/wiki/index.php/Transmission_daemon
或者中文: https://www.right.com.cn/forum/viewthread.php?tid=22477

这是一个漂亮, 易用, 多平台的客户端. 先来安装软件包
ipkg-opt install transmission

运行一下, 产生初始配置文件:
transmission-daemon -g /opt/share/transmission/
killall transmission-daemon

vi /opt/share/transmission/settings.json
调整配置参数, 详情参见: http://trac.transmissionbt.com/wiki/EditConfigFiles 需要注意的有:
#下载目录:
    "download-dir": "\/opt\/transmission\/downloads",

#监听端口, 需要放开:
    "peer-port": 51413,

#Web界面和远程控制相关:
    "rpc-authentication-required": true,
    "rpc-bind-address": "0.0.0.0",
    "rpc-enabled": true,
    "rpc-password": "xxxzzz",
    "rpc-port": 9091,
    "rpc-username": "eric",
    "rpc-whitelist": "127.0.0.1,192.168.*.*",
    "rpc-whitelist-enabled": true,


#速度限制:
    "speed-limit-down": 100,
    "speed-limit-down-enabled": false,
    "speed-limit-up": 30,
    "speed-limit-up-enabled": true,


#监听端口, 建议将其加入启动或防火墙脚本
iptables -I INPUT -p tcp --dport 51413 -j ACCEPT
iptables -I INPUT -p udp --dport 51413 -j ACCEPT

再次启动Transmission:
transmission-daemon -g /opt/share/transmission/

内置Web界面:
http://192.168.11.1:9091/

另外有功能更丰富的第三方客户端软件:
transmisson-remote-gui: http://code.google.com/p/transmisson-remote-gui/
transmission-remote-dotnet: http://code.google.com/p/transmission-remote-dotnet/

都是仿uTorrent界面, 后者基于.NET, 推荐前者.


rTorrent:

参照: https://www.right.com.cn/forum/viewthread.php?tid=13200

rTorrent是Unix下一个文件界面的BT客户端, 以速度著称, 甚至被上面的帖子称为Linux下的BT速度之王.
安装rtorrent, 以及screen(或dtach)以支持NOHUP运行rtorrent:
ipkg-opt install rtorrent screen

vi /opt/etc/rtorrent.conf

调整配置, 详情参见: http://libtorrent.rakshasa.no/rtorrent/rtorrent.1.html, 除连接数, 速度, 目录外, 需要注意的有:

#监听端口:
port_range = 51777-51780

#UDP Tracker支持
use_udp_trackers = yes

#DHT网络相关
dht = auto
dht_port = 6881
peer_exchange = yes

#使用UFT-8编码以支持中文文件名
encoding_list = UTF-8

为支持终端下的中文显示, 还需要正确设置环境变量以及客户端(putty,SecureCRT)
export LANG=zh_CN.UTF-8
export LC_ALL=zh_CN.UTF-8

防火墙放开rtorrent的监听端口:
# Port range to use for listening.
#port_range = 51777-51780
iptables -I INPUT -p tcp --dport 51777:51780 -j ACCEPT
iptables -I INPUT -p udp --dport 51777:51780 -j ACCEPT
# UDP port to use for DHT.
#dht_port = 6881
iptables -I INPUT -p udp --dport 6881 -j ACCEPT

创建/opt/etc/rtorrent.conf中配置的目录:
mkdir -p /opt/share/torrent/work/
mkdir -p /opt/share/torrent/dl/
mkdir -p /opt/share/torrent/session/

rTorrent Man Page:
http://libtorrent.rakshasa.no/rtorrent/rtorrent.1.html
退格键增加.torrent, 方向键浏览已添加任务, 基本指令摘要如下:
^Q        退出rTorrent
^S        开始下载
^D        停止活动的下载, 或删除停止的下载
^K        关闭(暂停)下载
^R        HASH检查


Screen Man Page:
http://www.gnu.org/software/scre ... efault-Key-Bindings
IBM的Screen教程:
http://www.ibm.com/developerworks/cn/linux/l-cn-screen/
基本上只用到Detach:
C-a d
C-a C-d
(detach)
Detach screen from this terminal. See Detach.

C-a D D
(pow_detach)
Detach and logout. See Power Detach. (Detach并退出当前Shell)

使用screen管理rtorrent会话:
#开始前设置区域语言选项为UTF-8以支持中文:
export LANG=zh_CN.UTF-8
export LC_ALL=zh_CN.UTF-8

#以Detach模式启动名为rt的rtorrent会话, 不使用screen的流控制选项, 忽略~/.rtorrent.rc配置文件, 使用/opt/etc/rtorrent.conf
/opt/bin/screen -fn -dm -S rt /opt/bin/rtorrent -n -o import=/opt/etc/rtorrent.conf

#查看所有screen会话
screen -ls

#恢复rt会话.
screen -r rt

#如果只启动了一个会话:
screen -r

#断开会话:
C-a d


各种非文本接口参见: http://libtorrent.rakshasa.no/wiki/UtilsList

GUI界面:
nTorrent: http://code.google.com/p/ntorrent/
Java编写, 讨厌.

Web界面:
安装大同小异, 都需要首先设置rtorrent的XML-RPC, 增加以下行到rtorrent.conf:
scgi_local = /opt/.rtorrent-xmlrpc.socket

但好像有些Web界面与本地socket文件配合不太好, 改为监听loopback的5000端口:
scgi_port = 127.0.0.1:5000


apache在DD上工作不正常?? 安装lighttpd + php:
ipkg-opt install lighttpd php php-fcgi php-curl


确认正常工作:
cat > /opt/share/www/i.php
<?php
        phpinfo();
?>
^D

/opt/etc/init.d/S80lighttpd restart
http://192.168.11.1:8081/i.php

配置lighttpd的scgi:
cat > /opt/etc/lighttpd/conf.d/20-rtorrent-scgi.conf
server.modules += ( "mod_scgi" )

scgi.server = (
                "/RPC2" =>
                  ( "127.0.0.1" =>
                    (
                      "host" => "127.0.0.1",
                      "port" => "5000",
                      "check-local" => "disable",
                      "disable-time" => 0,  # don't disable scgi if connection fails
                    )
                  )
              )
^D

#
/opt/etc/init.d/S80lighttpd restart

大概介绍几个:
rTWi:
解包程序到/opt/share/www
cp includes/rtwi.conf.sample includes/rtwi.conf, 修改user_conf路径到www以外.
编辑users.conf以增加合适的用户, 用户名必须为操作系统用户, 密码为sha1加密的字串, 小写.

echo -n xxxzzz | sha1sum | cut -d ' ' -f 1


当前版本的rtwi好像有点bug, 使用RPC2能登陆但不能显示任务列表. 使用以下方式:

[eric]
address =        unix:///opt/.rtorrent-xmlrpc.socket
pass =                3a8105e3a76a6b858e7d45f559e89de9d8c988c1

或:

[eric]
address =        127.0.0.1:5000
pass =                3a8105e3a76a6b858e7d45f559e89de9d8c988c1


更进一步配置请参见!install.txt.

wTorrent:

参考: http://forum.synology.com/wiki/index.php/RTorrent_wTorrent_HowTo

解包程序到/opt/share/www, 当前版本(trunk-r99)少打包了个文件夹导致运行报错, 创建之:
mkdir /opt/share/www/wtorrent/tpl_c

wTorrent使用sqlite存储用户数据:
ipkg-opt install sqlite

把sqlite加入php扩展:
cat > /opt/etc/php.d/sqlite.ini
extension=sqlite.so
extension=pdo.so
extension=pdo_sqlite.so
^D


访问以下页面进行初始设置:
http://192.168.11.1:8081/wtorrent/install.php

注意 "Default folder to save torrent data:" 填写全路径rtorrent下载文件保存目录 "/opt/share/torrent/work/"


完成后删除wtorrent/install.php, 若希望重新设置, 删除wtorrent/db/database.db. 也可手工编辑conf/user.conf.php.


rtGui:
解包, 并修改xmlrpc和目录参数:
cp config.php.example config.php

rtGui使用了php的xmlrpc和多字节函数:
ipkg-opt install php-xmlrpc php-mbstring

OK.

ruTorrent:
解包. 修改config.php中的rtorrent的监听端口配置(不支持本地socket文件??):
    $scgi_port = 5000;
    $scgi_host = "127.0.0.1";

以上参数由rpc插件使用, rutorrent默认使用本地/RPC2?? 但可使用rpc插件强制rutorrent直接与rtorrent交互(不推荐).


插件使用很简单, 直接解包到plugins目录. 推荐edit, 方便添加tracker:)

rtGui, ruTorrent没有访问控制功能, 用httpd自带的实现一个:
#使用apache的htpasswd生成验证文件
htpasswd -cm passwd.lightpasswd eric

#配置lighttpd
cat > /opt/etc/lighttpd/conf.d/30-rutorrent-basic.conf
### auth module
# read /opt/share/doc/lighttpd/authentication.txt for more info
server.modules            += ( "mod_auth" )

## type of backend
# plain, htpasswd, ldap or htdigest
auth.backend               = "htpasswd"

## for htpasswd
auth.backend.htpasswd.userfile = "/opt/etc/passwd.lightpasswd"

## restrictions
# set restrictions:
#
# ( <left-part-of-the-url> =>
#   ( "method" => "digest"/"basic",
#     "realm" => <realm>,
#     "require" => "user=<username>" )
# )
#
# <realm> is a string to display in the dialog
#         presented to the user and is also used for the
#         digest-algorithm and has to match the realm in the
#         htdigest file (if used)
#

auth.require               = (
                               "/rtorrent" =>
                               (
                                 "method"  => "basic",
                                 "realm"   => "ruTorrent@DD-WRT",
                                 "require" => "valid-user"
                               )
                             )

^D


以上4个Web界面, 感觉rtGui和ruTorrent更对胃口些. 推荐rutorrent, 仿utorrent界面, 插件系统, 界面亲切, 功能强大.



rTorrent终极优化攻略:
http://bbs.baoyinet.com/viewthre ... &extra=page%3D1
我的恩山、我的无线 The best wifi forum is right here.
沙发,强帖留名
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

有疑问请添加管理员QQ86788181|手机版|小黑屋|Archiver|恩山无线论坛(常州市恩山计算机开发有限公司版权所有) ( 苏ICP备05084872号 )

GMT+8, 2024-4-28 02:56

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

| 江苏省互联网有害信息举报中心 举报信箱:js12377 | @jischina.com.cn 举报电话:025-88802724 本站不良内容举报信箱:68610888@qq.com 举报电话:0519-86695797

快速回复 返回顶部 返回列表