如何挂PT: Docker安装配置rutorrent和utorrent实现RSS订阅自动下载

rutorrent和utorrent的安装配置比较麻烦,方便起见可以使用一键脚本,比如rtinst。rtinst使用方便,几乎全程自动,但会自动创建新的系统账户并禁用root登录,安装后需要执行sed -i '/^PermitRootLogin/ c\PermitRootLogin yes' /etc/ssh/sshd_config && sudo service ssh restart。之后,就能开始下载PT。

但如果一台服务器或VPS上同时运行多种服务,一键脚本会自动安装各种依赖包,可能会对原有的包造成冲突,后续管理也比较麻烦。这也是本人不喜欢用一键脚本的原因。另外,由于兼容性,一键脚本在不同系统中可能有小问题出现。这里介绍一下通过Docker的方式安装配置rutorrent和utorrent,管理起来比较方便,操作也简单,也不必安装各种依赖包。成功安装配置后,一般就能直接用RSS订阅实现自动下载。

安装docker

CentOS 7

yum -y install docker-io

开启docker服务:

service docker start

测试docker是否安装成功,如果成功,会提示成功运行:

docker run hello-world

Ubuntu

安装docker:

sudo apt-get install apt docker.io

开启docker服务:

service docker start

下载镜像

官方文档在https://hub.docker.com/r/diameter/rtorrent-rutorrent。这里只介绍基本的操作,如果要设置SSL或其他东西,请参考文档。

下载rutorrent和utorrent的镜像:

docker pull diameter/rtorrent-rutorrent

创建utorrent下载目录

假设要设置utorrent的下载目录为/home/rtorrent

mkdir /home/rtorrent
chmod 777 /home/rtorrent

注意,要把挂载的目录权限设为777,不然无法下载。

设置访问密码

考虑到安全问题,一般会给rutorrent的网页访问设置用户名和密码,保障安全。密码存放在/home/rtorrent.htpasswd文件中,yourusername是用户名,yourpassword是密码:

printf "yourusername:$(openssl passwd -crypt yourpassword)\n" >> /home/rtorrent/.htpasswd

如果没有安装openssl,需先安装openssl。也可以使用其他加密方式,具体参考官方文档。

开启容器

镜像下载成功后,可用不同的配置运行。假设rtorrent的下载目录是/home/rtorrent

运行64位版本,通过http方式的连接:

docker run -dt --name rtorrent-rutorrent -p 8080:80 -p 49160:49160/udp -p 49161:49161 -v /home/rtorrent:/downloads diameter/rtorrent-rutorrent:latest

运行64位版本,通过https方式连接:

docker run -dt --name rtorrent-rutorrent -p 443:443 -p 49160:49160/udp -p 49161:49161 -v ~/test:/downloads diameter/rtorrent-rutorrent:latest

运行32位版本,可同时通过http和https方式连接:

docker run -dt --name rtorrent-rutorrent -p 8080:80 -p 443:443 -p 49160:49160/udp -p 49161:49161 -v ~/test:/downloads diameter/rtorrent-rutorrent:latest-32

容器成功启动后,如果要通过http的方式连接,输入 http://ip地址:8080 打开页面(可根据需要改端口),如果要通过https方式连接,则输入 https://ip地址 。如果打开了防火墙,注意要开放相应端口。成功打开网页界面后,就能配置RSS订阅实现自动下载功能。

Docker的简单使用

查看运行的docker:

docker ps -a

停止:

docker stop id或者name
# id和name可在docker ps -a中查看

重启:

docker restart id

删除:

docker rm id

了解Docker更多使用方法,可参考Docker教程

© 版权声明
THE END
喜欢就支持以下吧
点赞0 分享
评论 共2条
头像
欢迎您留下宝贵的见解!
提交
头像

昵称

取消
昵称表情代码图片
    • 头像清风0
    • 头像征征0