Pages

Saturday, 2 July 2016

安装rtorrent/rutorrent

rtorrent是利用libtorrent库创建的Ncurses客户端程序。使用C++语言编写 的rtorrent除了能够提供基于GUI界面的客户端所具备的功能之外,其速度和效率更为用户所推崇。


rutorrent是rtorrent的一个webgui。但不支持rtorrent0.8.7版。

rtorrent安装过程

教程使用的是目前最新版libtorrent和rtorrent,日后要想安装最新版,请到这里下载:http://libtorrent.rakshasa.no/downloads/

一、安装libtorrent

1
2
3
4
5
yum -y install gcc-c++ libtool libsigc++20 libsigc++20-devel
wget http://libtorrent.rakshasa.no/downloads/libtorrent-0.13.3.tar.gz
tar zxvf libtorrent-0.13.3.tar.gz
./configure
make && make install

二、安装rtorrent

在安装rtorrent之前需要先安装xmlrpc(如果想用webgui的话…
yum -y install xmlrpc-c-devel
echo "/usr/local/lib/" >> /etc/ld.so.conf
wget http://libtorrent.rakshasa.no/downloads/rtorrent-0.9.3.tar.gz
tar zxvf rtorrent-0.9.3.tar.gz
PKG_CONFIG_PATH=/usr/local/lib/pkgconfig ./configure --with-xmlrpc-c
make && make install

rtorrent启动脚本

wget -O /etc/init.d/rtorrent https://github.com/asuna/personal-scripts/raw/master/init.d/rtorrent
chmod 755 /etc/init.d/rtorrent
使用方法:service rtorrent {start|stop|restart}

rtorrent配置文件(sample)

https://gist.github.com/1325923

rtorrent xmlrpc-c配置

cat >>~/.rtorrent.rc<<-EOF
execute_nothrow=rm,/tmp/rpc.socket
scgi_local = /tmp/rpc.socket
schedule = chmod,0,0,"execute=chmod,777,/tmp/rpc.socket"
EOF

Nginx xmlrpc 配置

修改nginx.conf,在server字段添加下列内容
1
2
3
4
5
location /RPC2 {
include scgi_params;
#scgi_pass 127.0.0.1:5000;
scgi_pass unix:/tmp/rpc.socket;
}
不知道nginx.conf在哪的话可以用以下命令查找
1
whereis nginx

rutorrent安装过程

wget http://dl.bintray.com/novik65/generic/rutorrent-3.6.tar.gz
tar zxvf rutorrent-3.6.tar.gz
mv rutorrent /home/wwwroot
cp /home/wwwroot/rutorrent/conf/config.php /home/wwwroot/rutorrent/conf/config.php.bak
sed -i 's/\/\/ $scgi/$scgi/g' /home/wwwroot/rutorrent/conf/config.php
sed -i 's/$scgi_port = 5000/\/\/ $scgi_port = 5000/g' /home/wwwroot/rutorrent/conf/config.php
sed -i 's/$scgi_host = "127/\/\/ $scgi_host = "127/g' /home/wwwroot/rutorrent/conf/config.php
sed -i "s/\"curl\"\t=> ''/\"curl\"\t=> '\/usr\/bin\/curl'/g" /home/wwwroot/rutorrent/conf/config.php
sed -i "s/\"gzip\"\t=> ''/\"gzip\"\t=> '\/usr\/bin\/gzip'/g" /home/wwwroot/rutorrent/conf/config.php
sed -i "s/\"id\"\t=> ''/\"id\"\t=> '\/usr\/bin\/id'/g" /home/wwwroot/rutorrent/conf/config.php
sed -i "s/\"stat\"\t=> ''/\"stat\"\t=> '\/usr\/bin\/stat'/g" /home/wwwroot/rutorrent/conf/config.php
此处的/home/wwwroot为网站根目录

创建访问密码

 htpasswd -b -c /home/wwwroot/rutorrent/.htpasswds username passwd
如果htpasswd: command not found,执行下面命令安装httpd-tool
yum install -y httpd-tools
修改nginx.conf,在server字段添加下面内容
1
2
3
4
location /rutorrent {
auth_basic "ruTorrent login";
auth_basic_user_file /home/wwwroot/rutorrent/.htpasswds;
}

rutorrent插件安装(可忽略)

wget http://dl.bintray.com/novik65/generic/plugins-3.6.tar.gz
tar zxvf plugins-3.6.tar.gz
mv plugins /home/wwwroot/rutorrent
刷新rutorrent页面就可看到效果

安装完成


访问http://yourip(or domain)/rutorrent,输入设置的账号密码即可使用.