MENU

刷分带师指南 —— 使用 rtorrent 搭建自己的 PT 盒子

2019 年 12 月 14 日 • 默认分类,技术阅读设置

本文全文禁止转载。

rtorrent +rutorrent

rtorrent 是一款非常优秀的种子下载工具,效率高上传大,作为一名刷分带师你需要这个申必武器。

在这篇文章中,我们会在 Debian 10 发型版中分别编译其依赖和本体达到最大性能。

编译 rtorrent

0x00 准备工作

wget -O /etc/apt/trusted.gpg.d/nginx-mainline.gpg https://packages.sury.org/nginx-mainline/apt.gpg
wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
echo "deb https://packages.sury.org/nginx-mainline/ buster main" > /etc/apt/sources.list.d/nginx.list
echo "deb https://packages.sury.org/php/ buster main" > /etc/apt/sources.list.d/php.list
apt update
apt dist-upgrade -y
apt install -y build-essential libc-ares-dev libbrotli-dev libidn2-dev libnghttp2-dev ca-certificates zlib1g-dev libncurses-dev libxmlrpc-c++8-dev libssl-dev unrar-free unzip ffmpeg mediainfo sqlite3 sox bzip2 git -y

0x01 编译 libcurl

rTorrent 在 tracker 请求和 http 下载期间的 DNS 查询会阻塞线程运行,我们需要手动编译带有 c-ares 支持的 libcurl 来避免这种情况。(官方说用单独线程查询在咕了!)

https://github.com/curl/curl/releases 在这里找到最新的 release 下载解压。

cd /usr/local/
wget RELEASE_URL
tar -xf curl-*.tar.* && rm -f curl-*.tar.*
cd curl-*/
./configure --prefix=/usr/local/libcurl --disable-debug --enable-optimize --disable-manual --enable-ipv6 --enable-openssl-auto-load-config --enable-threaded-resolver --with-zlib --enable-ares --with-brotli --with-libidn2 --with-nghttp2 --enable-alt-svc
make -j$(nproc) && make install
rm -f /usr/bin/curl && ln -s /usr/local/libcurl/bin/curl /usr/bin/curl

0x02 编译 libtorrent

https://github.com/rakshasa/rtorrent/releases 在这里找到最新的 libtorrent release 下载解压。

cd /usr/local/
wget RELEASE_URL
tar -xf libtorrent-*.tar.gz && rm -f libtorrent-*.tar.gz
cd libtorrent-*/
./configure --disable-debug
make -j$(nproc) && make install

0x03 编译 rtorrent

https://github.com/rakshasa/rtorrent/releases 在这里找到最新的 rtorrent release 下载解压,写文时是 0.9.8。

cd /usr/local/
wget RELEASE_URL
tar -xf rtorrent-*.tar.gz && rm -f rtorrent-*.tar.gz
cd rtorrent-*
./configure --disable-debug --enable-ipv6 --with-ncurses --with-xmlrpc-c --with-libcurl=/usr/local/libcurl
make -j$(nproc) && make install

到这里高性能 rtorrent 就编译完成了。

安装 rutorrent

0x10 安装 nginx + php-fpm

apt install -y nginx-extras php7.4 php7.4-cli php7.4-fpm php7.4-cgi php7.4-mysql php7.4-curl php7.4-gd php7.4-mbstring php7.4-xml php7.4-xmlrpc php7.4-opcache php7.4-zip php7.4-json php7.4-bz2 php7.4-bcmath php-geoip apache2-utils
systemctl enable --now nginx php7.4-fpm
sed -i 's/upload_max_filesize = 2M/upload_max_filesize = 1024M/' /etc/php/7.4/fpm/php.ini
sed -i 's/post_max_size = 8M/post_max_size = 1024M/' /etc/php/7.4/fpm/php.ini
systemctl restart php7.4-fpm

0x11

拉取 rutorrent 源码到网站目录。

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

添加新的 nginx 配置文件。

server {
    listen 0.0.0.0:8080 default reuseport fastopen=3;
    listen [::]:8080 default reuseport fastopen=3;
    server_name _;
    client_max_body_size 64M;
    server_tokens off;

    root /var/www/rutorrent;
    index index.html index.htm index.php;

    location / {
        try_files $uri $uri/ =404;
        }

    location /RPC2 {
        include scgi_params;
        scgi_pass "unix:///var/www/rtorrent/.session/rpc.socket";
    }

    location ~ \.php$ {
        fastcgi_pass unix:/run/php/php7.4-fpm.sock;
        include snippets/fastcgi-php.conf;
    }
}

编辑 /var/www/rutorrent/conf/config.php

最后编辑于: 2020 年 05 月 18 日