- 论坛徽章:
- 0
|
rtorrent从0.7.5版本后开始内嵌xmlrpc接口,支持远程控制。而ntorrent就是基于rtorrent的xmlrpc接口做的。
xmlrpc的基本原理如下:
可以看出xml-rpc在传输中用的是http协议,所以就需要用到apache2或者lighttpd服务器了。
首先讲一下利用lighttpd服务器时怎么配置rtorrent对xmlrpc的支持:
利用源码包安装rtorrent(0.7.5 or later),编译时加上编译选项--with-xmlrpc-c
安装lighttpd:sudo apt-get install lighttpd
安装xmlrpc-c
在rtorrent的配置文件.rtorrent.rc中添加一行:
scgi_port = localhost:5000
5. 在/etc/lighttpd/lighttpd.conf中添加以下几行:
# ipkg update
# ipkg install rtorrent
# ipkg install lighttpd
# (add mod_scgi and config RPC mount point to /opt/etc/lighttpd.conf), below is the diff after I made the change
--- lighttpd.conf.dist 2007-10-30 17:57:18.000000000 +0000
+++ lighttpd.conf 2007-11-01 20:31:39.000000000 +0000
@@ -33,6 +33,7 @@
# "mod_expire",
# "mod_secdownload",
# "mod_rrdtool",
+ "mod_scgi",
"mod_accesslog" )
## a static document-root, for virtual-hosting take look at the
@@ -319,3 +320,13 @@
#include_shell "echo var.a=1"
## the above is same as:
#var.a=1
+
+scgi.server = (
+"/RPC2" => (
+ "127.0.0.1" => (
+ "host" => "127.0.0.1",
+ "port" => 5000,
+ "check-local" => "disable"
+ )
+ )
+)
重启lighttpd:sudo /etc/init.d/lighttpd restart
打开rtorrent软件:rtorrent
在终端中执行:xmlrpc localhost system.listMethods
会显示如下内容:
Index 0 String: 'system.listMethods'
Index 1 String: 'system.methodExist'
Index 2 String: 'system.methodHelp'
Index 3 String: 'system.methodSignature'
Index 4 String: 'system.multicall'
Index 5 String: 'system.shutdown'
Index 6 String: 'system.capabilities'
Index 7 String: 'system.getCapabilities'
Index 8 String: 'and'
Index 9 String: 'argument.0'
Index 10 String: 'argument.1'
......
这就表明xmlrpc可以连上rtorrent了。
下面该安装ntorrent了,下载ntorrent:
http://code.google.com/p/ntorrent/downloads/list
ntorrent是基于java开发的,所以在运行ntorrent之前得先配置好java环境:
http://forum.ubuntu.org.cn/viewtopic.php?t=119815
如果要在windows下配置java环境的话,自己g一下吧。
现在直接运行ntorrent:sh nTorrent.sh
经过简单配置就可以了。
同样,利用apache2服务器进行xmlrpc命令的转发也行,不过apache2默认是没有scgi模块的(Lighttpd should have this built-in),得自己动手链接这个模块。
sudo apt-get install libapache2-mod-scgi 这样在/etc/apache2/mods-avalable目录下就会多一个scgi.load文件。
创建这个文件的软连接,放在/etc/apache2/mods-enable目录下:ln -s /etc/apache2/mods-avalable/scgi.load /etc/apache2/mods-enable/scgi.load 这样apache2就加载上scgi模块了。
重启apache2:sudo /etc/init.d/apache2 restart
在apache的配置文件/etc/apache2/httpd.conf中添加一行:
SCGIMount /RPC2 127.0.0.1:5000
同样在.rtorrent.rc中添加一行:
scgi_port = localhost:5000
然后开启rtorrent,在终端中试试这条命令:xmlrpc localhost system.listMethods
如果输出同上,表明xmlrpc和rtorrent连接正常。
以后下载ntorrent、配置java环境等步骤同上面所讲。
参考资料:
RtorrentWithRemoteGUI:
http://www.nslu2-linux.org/wiki/HowTo/RtorrentWithRemoteGUI
Using XMLRPC with rtorrent:
http://libtorrent.rakshasa.no/wiki/RTorrentXMLRPCGuide
ubuntu下java开发环境搭建:
http://forum.ubuntu.org.cn/viewtopic.php?t=119815
本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u2/86590/showart_1999581.html |
|