rTorrent + ruTorrent 安装和配置

原文地址:http://wangyan.org/blog/rtorrent-and-rutorrent-tutorial.html

rTorrent 是一款非常简洁优秀的BT客户端,它完全基于文本并可以在Linux终端中运行。ruTorrent 是基于PHP的一个rTorrent前端,提供图形化的界面来管理 rTorrent。

一、编译安装 libtorrent

1.1 安装编译工具

1.yum -y install gcc-c++ libtool

2.yum -y install libsigc++20 libsigc++20-devel

1.2 下载、编译、安装

1.wget http://libtorrent.rakshasa.no/downloads/libtorrent-0.12.9.tar.gz

2.tar -zxf libtorrent-0.12.9.tar.gz

3.cd libtorrent-0.12.9

4../configure

5.make && make install

二、编译安装 rtorrent

2.1 安装依赖的软件包

1.yum -y install gcc-c++ libtool

2.yum -y install libsigc++20 libsigc++20-devel

2.2 配置环境变量

注:如果不先做这步,可能出现无法找到 libtorrent.so.5 等错误。

1.echo "/usr/local/lib/" >> /etc/ld.so.conf

2.ldconfig

3.export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig

2.3 安装 xmlrpc

如果你想直接通过web界面管理rtorrent,则此步不能省。rtorrent 0.7.5 以后的版本web gui是通过xmlrpc来驱动。

1.yum -y install xmlrpc-c-devel

2.4 编译安装 rtorrent

1.wget http://libtorrent.rakshasa.no/downloads/rtorrent-0.8.9.tar.gz

2.tar -zxf rtorrent-0.8.9.tar.gz

3.cd rtorrent-0.8.9

4../configure --with-xmlrpc-c

5.make && make install

三、rTorrent 使用方法

3.1 rtorrent 后台启动脚本

该脚本用于管理rtorrent,包括启动、停止、重启操作,脚本内容见下面链接。

https://gist.github.com/1326099

注:若不想以root身份运行该脚本,请修改替换rtorrent.sh中的root字符。

1.wget http://wangyan.org/download/shell/rtorrent.sh

2.mv rtorrent.sh /etc/init.d/rtorrent

3.chmod a+x /etc/init.d/rtorrent

3.2 rtorrent 运行方法

方法一(推荐):使用上述管理脚本

方法二(推荐):通过Screen使用rTorrent,然后通过+A+D挂起、screen -r 恢复,详细快捷键见screen相关文档。

方法三:直接在终端运行,然后通过+Q 退出。详细快捷键见官方文档《RTorrentUserGuide》

1./usr/local/bin/rtorrent

3.3 rtorrent 配置

配置 rtorrent 是通过位于/home/username/.rtorrent.rc文件来完成。官方示例配置文件见《rtorrent.rc example》

配置文件中文解释见下面链接,我不直接贴代码了,以免浪费文章篇幅。

https://gist.github.com/1325923

注:配置文件里面所指定的目录要保证存在,否则启动rtorrent出错,可通过下面命令创建。

mkdir -p ~/rtorrent/{download, .session, .watch}

四、ruTorrent 安装配置

ruTorrent 是用来可视化管理 rtorrent的,它本身非常简洁,但可通过插件实现非常强大的功能。

4.1 rtorrent xmlrpc-c 配置

安装配置ruTorrent需保证,支持php和xmlrpc-c的Web环境已经配置好,否则出错。web套件可以是 lighttpd、apache、nginx。

xmlrpc-c 配置可参见官方文档《Using XMLRPC with rtorrent》本文以Nginx为例来说明。

方法一:(官方不推荐)

1.cat >>~/.rtorrent.rc<<-EOF

2.scgi_port = localhost:5000

3.EOF

方法二:(官方推荐)

注意:下面三行代码一行都不能少,先后顺序不能变,否则出现 "Could not prepare socket for listening: Address already in
use" 错误!

1.cat >>~/.rtorrent.rc<<-EOF

2.execute_nothrow=rm,/tmp/rpc.socket

3.scgi_local = /tmp/rpc.socket

4.schedule = chmod,0,0,"execute=chmod,777,/tmp/rpc.socket"

5.EOF

4.2 Nginx xmlrpc 配置

修改nginx站点配置文件,在server字段加入下面内容。

1.location /RPC2 {

2.include scgi_params;

3.#scgi_pass 127.0.0.1:5000;

4.scgi_pass unix:///tmp/rpc.socket;

5.}

4.3 ruTorrent 安装配置

ruTorrent 详细配置可查看官方文档《ruTorrent Configuration》

1.wget http://rutorrent.googlecode.com/files/rutorrent-3.3.tar.gz

2.tar -zxf rutorrent-3.3.tar.gz

3.mv rutorrent  /var/www

4.chown -R www-data:www-data  /var/www/rutorrent/share/

5.sed -i 's/\/\/ $scgi/$scgi/g' /var/www/rutorrent/conf/config.php

6.sed -i 's/$scgi_port = 5000/\/\/ $scgi_port =
5000/g'/var/www/rutorrent/conf/config.php

7.sed -i 's/$scgi_host = "127/\/\/ $scgi_host =
"127/g'/var/www/rutorrent/conf/config.php

4.4 ruTorrent 访问密码保护

创建密码文件

1.htpasswd -b -c
/var/www/rutorrent/.htpasswds username passwd

修改nginx站点配置文件

1.location /rtorrent {

2.auth_basic "ruTorrent
login";

3.auth_basic_user_file
/var/www/rtorrent/.htpasswds;

4.}

五、结束

安装完成后,通过 http://youdomain/rutorrent 访问,然后输入帐号和密码即可看到以下界面。嗯,欢呼吧!混PT的小水管们。。。

参考资料:

1. http://libtorrent.rakshasa.no/wiki
2. https://wiki.archlinux.org/index.php/RTorrent
3. http://blog.45639.com/post-27.html
4. http://snowwolf725.blogspot.com/...

 

原文链接: https://www.cnblogs.com/AloneSword/p/4677501.html

欢迎关注

微信关注下方公众号,第一时间获取干货硬货;公众号内回复【pdf】免费获取数百本计算机经典书籍

    rTorrent + ruTorrent 安装和配置

原创文章受到原创版权保护。转载请注明出处:https://www.ccppcoding.com/archives/219672

非原创文章文中已经注明原地址,如有侵权,联系删除

关注公众号【高性能架构探索】,第一时间获取最新文章

转载文章受原作者版权保护。转载请注明原作者出处!

(0)
上一篇 2023年2月13日 上午10:38
下一篇 2023年2月13日 上午10:38

相关推荐