• PtBoxClub

通过rtinst脚本安装Rtorrent+rutorrent(附版本切换教程)

PT教程 半醉丶 7年前 (2017-09-27) 32312次浏览 24个评论
目录
[隐藏]

最新更新:2018/1/14  “简单配置以支持 rt 文件拖回本地”

注意:先说下使用环境,Debian8/9 和 Ubuntu14.04 及以上,其中Debian9仅支持rtorrent0.9.6版本

1.脚本介绍

Github 链接: https://github.com/arakasi72/rtinst

主要功能: 一键安装 rtorrent 和 rutorrent 以及配套软件 nginx 和 irssi

2.安装脚本

2.1.初始化环境

通过 xshell 或者 putty 连接上服务器后,执行以下命令(需要使用 root 用户登录)

bash -c "$(wget --no-check-certificate -qO - https://raw.githubusercontent.com/arakasi72/rtinst/master/rtsetup)"

通过 rtinst 脚本安装 Rtorrent+rutorrent(附版本切换教程)

2.2.一键安装

初始化好 rtinst 环境后,执行以下命令安装

rtinst -t -d

-t 参数可以保持你的 SSH 端口不变,因为脚本在安装结束时默认会更改你的 SSH 端口

-d 参数开启下载功能,就是说你访问如下网址就可以在网页上显示你的下载目录,默认时 download 文件夹,这样你就可以从网页下载文件到本地了

http://盒子 IP/download/用户名

通过 rtinst 脚本安装 Rtorrent+rutorrent(附版本切换教程)

然后依次输入 y,回车,输入用户名,回车,y,回车,输入 2 次密码,这个是你新建用户的密码,再次输入 2 次密码,这是 webui 的密码,怕遗忘,都设置成一样的就可以了,然后就开始安装了,视机器性能,安装时间 5-30 分钟不等。

3.优化配置

3.1.更新 nginx 配置

安装结束后默认开启 https,又要额外配置证书密钥,为简化流程,修改文件 /etc/nginx/sites-enabled/default 为如下内容即可

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;
        }
}

然后运行命令 /etc/init.d/nginx restart 重启 nginx,使修改生效。

3.2.更新 ssh 配置

安装完成后脚本会关闭 root 登录,所以你下次通过 shell 连接的时候 root 用户就登陆不上了,你需要按照如下要求修改文件 /etc/ssh/sshd_config 即可恢复。

修改以下项

PermitRootLogin yes

注释以下项

#AllowGroups sudo sshuser

然后执行

service ssh restart

使修改生效,这样以后还是可以使用 root 用户登录系统。

当然也可以使用一开始配置的用户名和密码登陆,然后执行命令 su ,再输入 root 用户的密码,同样可以进入 root 账户模式。

4.开始使用

当你完成以上所有操作后,访问如下地址

http://盒子 IP/rutorrent

用户名和密码时你在第二步设置好了的,然后你就进入了 rt 的 web 界面了。

5.常见问题汇总

5.1.更换 rt 版本

执行以下命令

wget  https://raw.githubusercontent.com/arakasi72/rtinst/master/scripts/rtupdate 
bash rtupdate

通过 rtinst 脚本安装 Rtorrent+rutorrent(附版本切换教程)

5.2.修改 webui 密码

执行以下命令

htpasswd –c /etc/nginx/.htpasswd 新用户名

回车,依次输入 2 次新的密码,然后刷新 webui,修改完毕。

如果没生效,执行 /etc/init.d/nginx restart 重启 nginx 即可。

5.3.配置 RSS

打开 webui,左下角右键所有订阅即可添加 rss

通过 rtinst 脚本安装 Rtorrent+rutorrent(附版本切换教程)

想要添加的 rss 自动下载,请看下图。

点击上方 RSS 设置,添加新 RSS 配置,名称随意,然后在过滤器中填上 /^/ ,然后点击 2 次目录右方三个点,自动选择目录,然后确定即可。

通过 rtinst 脚本安装 Rtorrent+rutorrent(附版本切换教程)

5.4.文件拖回本地

这个功能可以实现将盒子任意位置的文件展示在网页上!

比如说你的 IP 是 1.1.1.1,那个当你完成了如下操作,你访问 1.1.1.1/rtdown 就可以看到/home/pthezi/rtorrent/download 这个文件夹内的文件了!

然后就可以直接将这个文件夹的文件在网页上下载回本地了!

而且你可以添加多个 location,rtdown 只是一个代号可以随意设置,alias 才是真正的目录位置!

修改 nginx 的配置文件 /etc/nginx/sites-enabled/default 添加如下内容

        location /rtdown {
               auth_basic "Restricted";      #密码提示字段,可任意设置
               auth_basic_user_file /etc/nginx/.htpasswd;  #如果不需要访问密码,删掉此行和上一行即可
               alias /home/pthezi/rtorrent/download;    #这是 rt 默认存储位置,当然你也可以换成别的的
               autoindex on;
        }

执行

service nginx restart

访问如下地址,即可通过网页访问你通过 RT 下载好的文件,用户名密码和你登陆 RT 的 WEB 界面的一样

http://盒子 IP/rtdown
当然如果你只是想使用网页浏览 RT 的默认下载目录,参见 2.2 中的 -d 参数的作用即可

有什么问题给我留言吧。

:grin:


如无注明,所有文章皆为“半醉”原创,转载请保留文章出处。如有借鉴未注明请发邮件到 [email protected],深表抱歉!
喜欢 (79)
发表我的评论
取消评论
表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
(24)个小伙伴在吐槽
  1. 装完这个报错 Error downloading files. Make sure autodl-irssi is started and configured properly (eg. password, port number): Error getting files listing: Missing PHP modules: xml
    wjdrkd2017-11-15 12:01 回复 Windows 10 | Chrome 62.0.3202.89
  2. 请问装完了怎么重启?手动用screen吗?但是添加rss总是崩溃,说不支持
    raphael2018-01-14 22:18 回复 Windows 10 | Chrome 63.0.3239.132
    • 重启的话需要切换到你新建的那个用户,比如你在安装时创建的用户是admin,那么运行su admin,输入密码,然后rt restart 就可以了重启了
      半醉丶2018-03-11 22:03 回复 Windows 10 | Chrome 64.0.3282.167
  3. 能下载整个文件夹吗?如果不能有什么方案推荐吗?
    beelink3872018-04-15 17:49 回复 Mac OS X | Safari浏览器 604.5.6
    • 半醉丶
      太多文件推荐使用rclone利用网盘中转,onedrive网盘啊,google盘啊都可以,推荐googledrive盘,速度快 稳定!
      半醉丶2018-04-29 20:55 回复 Windows 10 | Chrome 66.0.3359.139
  4. 5.4. 文件拖回本地 修改完毕后,为什么访问不了目录说404错误啊!?跟上面http的那个在一起是怎么排序的?能否截个图。谢谢。。
    qwer1212018-04-23 01:56 回复 Windows 10 | Maxthon 浏览器5.2.1.5000
    • 半醉丶
      404错误可能是你alias后的那个路径不存在,或者文件夹是空的额!去检查下! 然后这个rtdown只是一个名称而已,你可以改成任意的!实际就是访问http://IP/rtdown就等于访问了alias指向的那个路径。
      半醉丶2018-04-29 21:00 回复 Windows 10 | Chrome 66.0.3359.139
  5. debian8-64位,安装使用都没问题,在此感谢作者。但是我更改webui用户名密码有点问题,执行htpasswd –c /etc/nginx/.htpasswd pt(这里的pt应该是新用户名吧)。并没有提示输入密码,而是提示如下,请大佬帮忙看下,谢谢。 Usage: htpasswd [-cimBdpsDv] [-C cost] passwordfile username htpasswd -b[cmBdpsDv] [-C cost] passwordfile username password htpasswd -n[imBdps] [-C cost] username htpasswd -nb[mBdps] [-C cost] username password -c Create a new file. -n Don't update file; display results on stdout. -b Use the password from the command line rather than prompting for it. -i Read password from stdin without verification (for script usage). -m Force MD5 encryption of the password (default). -B Force bcrypt encryption of the password (very secure). -C Set the computing time used for the bcrypt algorithm (higher is more secure but slower, default: 5, valid: 4 to 31). -d Force CRYPT encryption of the password (8 chars max, insecure). -s Force SHA encryption of the password (insecure). -p Do not encrypt the password (plaintext, insecure). -D Delete the specified user. -v Verify password for the specified user. On other systems than Windows and NetWare the '-p' flag will probably not work. The SHA algorithm does not use a salt and is less secure than the MD5 algorithm.
    ptnew2018-04-26 17:08 回复 Windows 10 | Chrome 65.0.3325.181
  6. autodl-irssi: 插件将不会工作. PHP 扩展必须被安装 (xml). 请问这个如何解决??debian9
    qwer1212018-05-03 01:51 回复 Windows 10 | Maxthon 浏览器5.2.1.6000
    • 半醉丶
      建议再次在终端执行一次安装命令 rtinst -l 然后查看rtinst.log文件的错误记录。
      半醉丶2018-05-03 10:59 回复 Windows 7 | Chrome 65.0.3325.162
  7. 你好,请问我原来ssh的root是密钥登陆,安装完以后root登陆方式改变了,密钥没用了,请问如何恢复以前用密钥登陆的方式?
    dd882018-07-15 22:35 回复 Windows 10 | Chrome 67.0.3396.99
    • 半醉丶
      再改一下/etc/ssh/sshd_config 这个文件就可以了呀! 你以前怎么开启密钥登陆的再来一次就好了!
      半醉丶2018-09-13 16:49 回复 Windows 10 | Chrome 68.0.3440.106
  8. 可以,mark一下
    柊叶2019-01-07 01:03 回复 Linux | Chrome 71.0.3578.99
  9. 2333杜甫无法用root登录怎么破
    柊叶2019-01-07 02:00 回复 Linux | Chrome 71.0.3578.99
    • 半醉丶
      修改ssh配置文件就行,一般是/etc/ssh/sshd_config文件!具体百度!
      半醉丶2019-03-01 17:14 回复 Windows 10 | Chrome 71.0.3578.98
  10. 5.4.文件拖回本地 按照流程来的,为什么无法打开网页呢?404提示。
    qwer1212019-09-03 17:35 回复 Windows 10 | Maxthon 浏览器5.2.7.5000
  11. 额。路径设置错了。抱歉。可以打开了。
    qwer1212019-09-03 17:37 回复 Windows 10 | Maxthon 浏览器5.2.7.5000
  12. 但是Chrome中文乱码,傲游倒是没什么问题。
    qwer1212019-09-03 17:44 回复 Windows 10 | Maxthon 浏览器5.2.7.5000
  13. 请问 5.4.文件拖回本地 IDM下载的时候需要验证用户名密码,但是如何实现多线程下载呢?
    qwer1212019-09-06 17:12 回复 Windows 10 | Maxthon 浏览器5.2.7.5000
  14. I think what you typed was very reasonable. However, think on this, what if you wrote a catchier title? I amm not saying your information isn't solid., hpwever what if yyou added a post title to possibly grtab folk's attention? I mean 通过rtinst脚本安装Rtorrent+rutorrent(附版本切换教程) | 半醉浮生丶 is kinda vanilla. You ought to peek at Yahoo's front page and watch how they write post titles to get viewers tto click. You might add a related video or a pic or two to get readers interested about what you've got to say. Just my opinion, it might bring your website a little livelier.
    Buy domain name2020-03-05 15:48 回复 Windows 7 | Chrome 65.0.3298.4
  15. Thanks for finally talking about >通过rtinst脚本安装Rtorrent+rutorrent(附版本切换教程) | 半醉浮生丶 <Liked it!
    best weight loss pills 20222021-12-14 12:05 回复 Linux | 未知浏览器