老司机坐骑——BT/PT盒子安装简明教程

感谢WolfSkylake大佬的大力滋磁,原文链接:https://www.mengclaw.com/2018/05/29/77/
说到云端下载器,就不得不提大名鼎鼎的Aria2了,他支持磁力,BT,以及直链的下载。但是有利就有弊,Aria2不是标准的PT/BT客户端,在很多PT站无法正常下载和上传,更有甚者,会判定是在作弊,严重者封号处理的下场。为了解决这个尴尬的局面,我们就要请上我们今天的主角——rTorrent。

rTorrent 是一个非常简洁、优秀、非常轻量的BT客户端. 它使用了 ncurses 库以 C++ 编写, 因此它完全基于文本并在终端中运行. 将 rTorrent 用在安装有 GNU Screen 和 Secure Shell 的低端系统上作为远程的 BT 客户端是非常理想的。

本教程为了简化步骤,将采用rtinst脚本① 进行安装。为了防止不必要的意外,请以root账户登陆服务器。

前提条件:
1、服务器系统:全新安装的 Ubuntu14+ / Debian8+(不兼容CentOS)
2、服务器内存:≥512MB
3、服务器磁盘:≥20GB(太小将会带来糟糕的体验)
4、虚拟化架构:KVM、Hyper-V、OpenVZ

1、防止系统过于精简,先更新系统软件源 :

apt-get update -y

2、安装常规依赖组件,防止出现 xxxx: command not found 的错误

apt-get install -y wget curl git vim unzip unrar-free

3、下载一键安装程序

bash -c "$(wget --no-check-certificate -qO - https://raw.githubusercontent.com/arakasi72/rtinst/master/rtsetup)"
 
# 下载安装包并且初始化软件环境

4、运行主脚本

rtinst -t

安装一开始,会提示:

Your Server IP is *.*.*.*
Is this correct y/n? 
 
# 这个时候,你需要输入“y”,并按回车键继续

然后他会要求你新建一个账户,用于搭建rTorrent,搭建后请使用新用户登陆SSH:

Enter user name: mengclaw
# 请键入新的用户名 比如 mengclaw
 
Confirm that user name is mengclaw y/n? y
# 确认你的用户名 输入y后,按回车键继续
 
Adding user `mengclaw' ...
Adding new group `mengclaw' (1000) ...
Adding new user `mengclaw' (1000) with group `mengclaw' ...
Creating home directory `/home/mengclaw' ...
Copying files from `/etc/skel' ...
 
Enter new UNIX password: mengclaw.com
# 请输入新账户密码 比如 mengclaw.com(建议自定义一个)
 
Retype new UNIX password: mengclaw.com
# 再次输入新账户密码 比如 mengclaw.com(建议自定义一个)
 
passwd: password updated successfully
Set Password for RuTorrent web client
Enter a password (6+ chars)
or leave blank to generate a random one
 
Please enter the new password: mengclaw.com
# 请输入新账户密码 (为了防止忘记密码,建议使用和上面一样的密码)
 
Enter the new password again: mengclaw.com
# 再次输入新账户密码 (为了防止忘记密码,建议使用和上面一样的密码)

最后出现这样的提示就说明安装并启动成功:

Thank You for choosing rtinst
 
# 感谢您选择rtinst

5、更新NGINX配置

# 以下全部内容是一个整体,是一个命令,全部复制粘贴到SSH软件中并一起执行!
 
echo "server {
        listen 80;
        root /var/www;
        index index.html index.php index.htm;
        client_max_body_size 40m;
        location / {
               try_files $uri $uri/ =404;
        }
        location /rutorrent {
               client_max_body_size 40m;
               auth_basic "Restricted";
               auth_basic_user_file /etc/nginx/.htpasswd;
               include /etc/nginx/conf.d/php;
               include /etc/nginx/conf.d/cache;
        }
        location ~ /\.ht {
                deny all;
        }
        location /rtdown {
               auth_basic "Restricted";      #密码提示字段,可任意设置
               auth_basic_user_file /etc/nginx/.htpasswd;  #如果不需要访问密码,删掉此行和上一行即可
               alias /home/mengclaw/rtorrent/download;    #这是rt默认存储位置,当然你也可以换成别的的
               autoindex on;  #启用文件管理
               charset utf-8,gbk;  # 避免中文乱码
        }
}" > /etc/nginx/sites-enabled/default

 

6、重启NGINX

service nginx restart

7、rTorrent 使用说明
访问WEB-UI进行下载:http://盒子IP/rutorrent
服务器文件拖回本地:http://盒子IP/rtdown

如果提示身份验证,账号为前面设置的用户名和密码

①Rtinst脚本,由arakasi72创建并且维护,详见:GitHub-Rtinst