QNAP 通过Container Station安装rtorrent/rutorrent

jsjcjsjc0条评论 272 次浏览

如果觉得麻烦,不如点我看小白教程?

当时购买QNAP 453Bmini有一个原因就是支持Docker/容器或者说Container Station,那还要什么群晖啊,支持Docker简直就是无限可能啊,下面就说一下如何通过Container Station安装rtorrent/rutorrent

创建LXC

直接去QNAP Store 安装Container Station,完成后打开新建Container,搜索 LXC,我这里安装的是debian 8

CPU/内存建议限制一下,名字随意


如果完全按照我的教程来,挂载路径写/home/jsjcjsjc/rtorrent/download

左边选择下载保存的路径,点击创建

开启远程SSH

完成后点击新建的LXC,名字可能和我不一样

敲几个回车按键准备输入命令啦

开启SSH登入

安装Vim

apt-get update && apt-get install -y vim

添加163的源,不然太慢了

rm -rf /etc/apt/sources.list
echo "deb http://mirrors.163.com/debian/ jessie main non-free contrib" > /etc/apt/sources.list
echo "deb http://mirrors.163.com/debian/ jessie-updates main non-free contrib" >> /etc/apt/sources.list
echo "deb http://mirrors.163.com/debian/ jessie-backports main non-free contrib" >> /etc/apt/sources.list
echo "deb-src http://mirrors.163.com/debian/ jessie main non-free contrib" >> /etc/apt/sources.list
echo "deb-src http://mirrors.163.com/debian/ jessie-updates main non-free contrib" >> /etc/apt/sources.list
echo "deb-src http://mirrors.163.com/debian/ jessie-backports main non-free contrib" >> /etc/apt/sources.list
echo "deb http://mirrors.163.com/debian-security/ jessie/updates main non-free contrib" >> /etc/apt/sources.list
echo "deb-src http://mirrors.163.com/debian-security/ jessie/updates main non-free contrib" >> /etc/apt/sources.list

安装ssh和wget,居然wget都没有

apt-get update && apt-get install -y openssh-client openssh-server
apt-get install -y ssh wget

开启ssh登入

vi /etc/ssh/sshd_config
PasswordAuthentication 注释去掉改成yes
PermitRootLogin注释去掉改成yes

下面就可以用putty等工具敲命令了

安装rtorrent/rutorrent

安装必要组件

apt-get -y update && apt-get install -y rtorrent build-essential subversion autoconf screen g++ gcc ntp curl comerr-dev pkg-config cfv libtool libssl-dev libncurses5-dev ncurses-term libsigc++-2.0-dev libcppunit-dev libcurl3 libcurl4-openssl-dev git unzip mediainfo nginx-full php php-fpm php-gd php-curl php-mysql php-memcache php-mbstring php-zip php-opcache

新建用户,输入密码后一路回车

adduser jsjcjsjc

新建目录

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

设置配置文件

cat >>/home/jsjcjsjc/rtorrent/.rtorrent.rc<<-EOF
scgi_port = 127.0.0.1:5000
directory = /home/jsjcjsjc/rtorrent/download/
session = /home/jsjcjsjc/rtorrent/.session
schedule = watch_directory,5,5,load_start=/home/jsjcjsjc/rtorrent/watch/*.torrent
schedule = untied_directory,5,5,stop_untied=
schedule = low_diskspace,5,60,close_low_diskspace=100000M
encryption = allow_incoming,enable_retry,prefer_plaintext
check_hash = no
dht = off
port_range = 31000-45000
port_random = no
peer_exchange = yes
EOF

设置权限

chown -R jsjcjsjc:jsjcjsjc /home/jsjcjsjc/rtorrent

下载rutorrent

cd /var/www/html/
git clone https://github.com/Novik/ruTorrent /var/www/html/rutorrent

设置权限

chown -R www-data:www-data /var/www/html/
adduser jsjcjsjc www-data

rutorrent需要php支持,添加对php的支持
vi /etc/nginx/sites-enabled/default

 location ~ \.php$ {
                try_files $uri =404;
                fastcgi_pass unix:/var/run/php5-fpm.sock;
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                include fastcgi_params;

        }

可以考虑加个密码,这里账号是admin/admin
http://tool.oschina.net/htpasswd可以生成自己密码,选择crypt

cat >>/var/.htpasswd<<-EOF
admin:.Kq8kgE3CRDv6
EOF
vi /etc/nginx/sites-enabled/default
auth_basic "Administrator Login";
auth_basic_user_file /var/.htpasswd;

重启nginx

nginx -t
service nginx restart

设置rtorrent开机启动

touch /root/rtorrent.sh
chmod +x /root/rtorrent.sh
cat >>/root/rtorrent.sh<<-EOF
#!/bin/bash
rm -f /home/jsjcjsjc/rtorrent/.session/rtorrent.lock
screen -d -m rtorrent -n -o import=/home/jsjcjsjc/rtorrent/.rtorrent.rc
EOF
sed -i '$i\/bin/bash /root/rtorrent.sh' /etc/rc.local

OK ,完成,下面将一下rtorrent如何配合flexget实现自动下载


发表评论

? razz sad evil ! smile oops grin eek shock ??? cool lol mad twisted roll wink idea arrow neutral cry mrgreen