东拼西凑,备忘属性很多,总之 CentOS 上跑 rtorrent 做 seedbox 大体需要以下这些:
- pkg-config
- libcurl
- openssl
- ncurses
- libsigc++
- libtorrent
- rtorrent
有的可以直接通过 yum 仓库安装,有的则需要编译,大体总结如下(可能有重复):
# yum install gcc # yum install gcc-c++ # yum install ncurses # yum install ncurses-devel
# cd /tmp/ # wget http://pkgconfig.freedesktop.org/releases/pkg-config-0.22.tar.gz # tar -zxvf pkg-config-0.22.tar.gz # cd pkg-config-0.22 # ./configure # make # make install
几个常见的包:
http://pkgconfig.freedesktop.org/releases/pkg-config-0.22.tar.gz
http://www.openssl.org/source/openssl-0.9.8g.tar.gz
http://ftp.gnome.org/pub/GNOME/sources/libsigc++/2.0/libsigc++-2.0.17.tar.gz
http://curl.haxx.se/download/curl-7.16.4.tar.gz
http://ftp.gnu.org/pub/gnu/ncurses/ncurses-5.6.tar.gz
安装完后设置 pkg-config 变量,否则 make libtorrent 的时候会报错
export PKG_CONFIG_PATH=/usr/local/ssl/lib/pkgconfig/
然后是 rtorrent 和其核心
# wget http://libtorrent.rakshasa.no/downloads/libtorrent-0.12.6.tar.gz # tar -zxvf libtorrent-0.12.6.tar.gz # cd libtorrent-0.12.6 # ./configure # make # make install
# wget http://libtorrent.rakshasa.no/downloads/rtorrent-0.8.6.tar.gz # tar -zxvf rtorrent-0.8.6.tar.gz # cd rtorrent-0.8.6 # ./configure # make # make install
至此基本安装完成,然后是 rtorrent 运行相关备忘
安装完后是没有配置文件的,所以需要从 此处 获取后复制到 ~/ 目录并设为隐藏(改名为 .rtorrent.rc),根据服务器硬件配置来编辑配置,编辑时去掉注释即可,简单总结下配置,包括一些自己添加的参数:
# Maximum and minimum number of peers to connect to per torrent. min_peers = 40 max_peers = 500 # Same as above but for seeding completed torrents (-1 = same as downloading) min_peers_seed = 40 max_peers_seed = 500 # Maximum number of simultanious uploads per torrent. max_uploads = 50 # Global upload and download rate in KiB. "0" for unlimited. download_rate = 0 upload_rate = 0 # Default directory to save the downloaded torrents. directory = ./ # Default session directory. Make sure you don't run multiple instance # of rtorrent using the same session directory. Perhaps using a # relative path? session = ./session # Port range to use for listening. port_range = 6890-6999 # Start opening ports at a random position within the port range. port_random = yes # Encryption options, set to none (default) or any combination of the following: # allow_incoming, try_outgoing, require, require_RC4, enable_retry, prefer_plaintext # # The example value allows incoming encrypted connections, starts unencrypted # outgoing connections but retries with encryption if they fail, preferring # plaintext to RC4 encryption after the encrypted handshake # # encryption = allow_incoming,enable_retry,prefer_plaintext # 开启加密协议,用于屏蔽迅雷吸血 encryption = allow_incoming,require,prefer_plaintext # Enable DHT support for trackerless torrents or when all trackers are down. # May be set to "disable" (completely disable DHT), "off" (do not start DHT), # "auto" (start and stop DHT as needed), or "on" (start DHT immediately). # The default is "off". For DHT to work, a session directory must be defined. # dht = on # UDP port to use for DHT. # dht_port = 9000 # Enable peer exchange (for torrents not marked private) # peer_exchange = yes # Change encoding for list encoding_list = UTF-8 # for rutorrent (need xmlrpc-c) # 使用 rutorrent 等前端需要 scgi_port = :500
先熟悉下 rtorrent 本身的操作,一些基本和常用的快捷键有:
- ctrl+q = 退出 rtorrent,如果没有 session 的话下次运行是会无列表加载
- 上下/左右 = 选择某项/进入退出详细列表
- ctrl+d = 停止种子,再点击则删除种子(生成的文件不会被删除)
详细的官方 wiki 可以参考 这里
在一个 terminal 实例中我们可以用 screen -r(yum install screen)来快速返回被切换到后台(ctrl+a-d)的 rtorrent
如果 terminal 不方便,可以用 rutorrent web 前端,配置他需要版本 >=1.1 的 xmlrpc-c 和 RPC 插件
# tar zxvf advanced.tar.gz # cd advanced # autoconf # chmod a+x configure # ./configure --prefix=/usr --disable-cplusplus # make # chmod a+x install-sh # make install
rtorrent:
# tar zvxf rtorrent-0.8.6.tar.gz # cd rtorrent-0.8.6 # ./configure --with-xmlrpc-c # make # make install
另外 rtorrent 还有一些别的插件,例如 GeoIP 用来显示 peer 国家, rss 读取等等