原文转载自http://www.ziliaoboke.com/pt-seedbox-transmission.html
最近喜欢上了玩PT,喜欢上了高清电影,在大概从4月29号开始起,大概20天的时间慢慢的收集到了中国的五大PT名站之CHD(http://chdbits.org/),HDC(https://hdchina.org/),HDS(http://www.hdstar.org/),HDR(http://hdroad.org/)的帐号,感谢邀请我的朋友们。尤其是CHD,HDC这两个PT站的帐号,还真是不容易。现在还有最后一个TTG(http://ttg.im/)的PT帐号等着收集。官方网站ttg.im说了在六月一号估计会有百分之一的概率开放注册。现在就等着那百分之一的概率开放注册了。PT站多了,尤其是这五大PT名站的帐号多了,而且基本上都有考核要求,而我又是小水管,想生存得好一点,自然想到了我买的那些又便宜,流量又大的vps,比如说1.04$的hostrail,参考这篇文章《Hostrail继续便宜实惠vps,每月只要1.05$,大概是7元人民币,初学者首选》,及directspace的2$及4$的vps,购买链接:ds 4$ ds6$。想在上面架设一些seedbox的软件,实现刷流量,免得被删除帐号,到时候想下载一些高清电影,就找不到帐号了。下面是在网上所介绍的关于在CentOS系统下架设SeedBox软件Transmission。当然,在前面我们也介绍了在CentOS系统下架设SeedBox软件rtorrent,同学们可以去围观一下。
下面介绍关于CentOS系统下架设SeedBox软件Transmission,分两个版本,一个是英文原版,一个是翻译的中文版。如果中文版里有出错的。建议对照英文版进行理解,尤其是vps命令!
为什么我需要一台 SeedBox ?
我现在的网络(TPG)最快下载速度为 1.6MB/S ,但是上传速度只有 100KB/S 。
看论坛里别人的 Ratio (分享率)好多都是 2+ 的,上传都是几TB,羡慕。
牛B啊,晾骚啊,咱可是用自己的独立 SeedBox ,下载上传速度唰唰的。
安装前的准备:
基本的计算机操作水平,小白退散。
一台 CentOS (64bit) 系统的服务器或者 VPS ,并且拥有 Root 权限。(当然Debian / Ubuntu 都是可以安装D)
会使用 Linux 基本的操作命令,会使用 SSH 连接控制服务器。(Windows 平台推荐 PuTTY ,MAC 下直接在 Terminal 终端里 SSH 连接即可)。下面请看安装过程:
安装
首先通过 SSH 连接软件,用你的 Root 帐户登录你的服务器或者 VPS。
安装更新软件Packages
安装 Transmission 软件需要运行的各类软件包,复制粘贴以下命令:
yum -y install gcc gcc-c++ m4 make automake libtool gettext openssl-devel pkgconfig perl-libwww-perl perl-XML-Parser curl curl-devel libevent-devel libevent libidn-devel zlib-devel
以及将系统内的软件升级为最新版本:
yum -y upgrade
这可能要花上几分钟至几十分钟的时间,取决于你使用的服务器的网络以及性能。
安装 intltool (国际化工具?这中文翻译真囧 -w-)
CentOS 系统自带的 intltool 早已经老化鸟,并且 yum 源里的 intltool 也很长时间没更新鸟,所以我们需要自行下载编译最新版本的 intltool ,复制粘贴以下命令:
cd /usr/local/src
wget http://ftp.gnome.org/pub/gnome/sources/intltool/0.40/intltool-0.40.6.tar.gz
tar zxf intltool-*.tar.gz
cd intltool-*
./configure -prefix=/usr
make -s
make -s install
安装 Transmission
选 Transmission 为 SeedBox 的软件是因为它的界面很 Mac 很骚,并且对 iPhone / iTouch 甚至我现在用的 BlackBerry 9700 手持设备进行了页面优化,复制粘贴以下命令:
cd /usr/local/src
wget http://download.m0k.org/transmission/files/transmission-2.13.tar.bz2
tar xjf transmission-*.tar.bz2
cd transmission-*
./configure -prefix=/usr
make -s
make -s install
2010-1-10日更新:代码中的红色部分为Transmission 2.13版本更新,如果以后Transmission升级鸟,你可以到这里查看最新版本的下载地址。
新建一个为运行 Transmission 的专有用户,更安全,更骚:
useradd -m transmission
passwd transmission
(输入你要设定的密码,按回车后再输一遍)
建立 init 文件,使 Transmission 可以在关机、重启后随系统开机运行:
wget -O /etc/init.d/transmissiond http://yeasiz.googlecode.com/files/transmission.sh
chmod 755 /etc/init.d/transmissiond
chkconfig --add transmissiond
chkconfig --level 345 transmissiond on
开始和停止 Transmission 守护进程,你应该可以看到2个绿色的[OK] :
service transmissiond start
service transmissiond stop
接着我们需要更改下 Transmission 的默认配置,关闭白名单和开启用户认证,请自行修改文中粗体的用户名(用户名)和密码(密码):
cd /home/transmission/.config/transmission/
sed -i 's/^.*rpc-whitelist-enabled.*/"rpc-whitelist-enabled": false,/' settings.json
sed -i 's/^.*rpc-authentication-required.*/"rpc-authentication-required": true,/' settings.json
sed -i 's/^.*rpc-username.*/"rpc-username": "用户名",/' settings.json
sed -i 's/^.*rpc-password.*/"rpc-password": "密码",/' settings.json
创建下载文件存放目录,给与其相应的写入读取权限:
mkdir -p /home/transmission/Downloads/
chown -R transmission.transmission /home/transmission/Downloads/
chmod g+w /home/transmission/Downloads/
至此,所有的安装项目都结束鸟,让我们开启 Transmission 的守护进程吧~
service transmissiond start
安装后的测试
在浏览器中打开下面的地址:
http://你服务器的ip地址:9091/transmission/web/
如图所示:
英文版如下:
Last updated: April 20, 2011.
Why do I need a seedbox?
Your ISP is blocking or throttling BitTorrent traffic.
The IT department at your work is blocking or throttling BitTorrent traffic.
You have a laptop and it is not practical to keep it running all the time.
You travel a lot and rarely stay online for a significant period of time to download a full torrent.
You are a member of a private torrent site and would like to maintain a good standing aka ratio.
You are tired of overpaying for seedbox hosting at other places.
And last, but not least, you’d like to maintain privacy!
What will I accomplish at the end of this howto?
A Linux box running Transmission BitTorrent client with web based access. Web based access is also optimized for iPhone.
A cross-platform desktop Transmission Remote GUI front end.
FTP access to download completed downloads.
What do I need to begin this guide?
Average computer skills.
Minimal Linux knowledge (basic shell commands).
A dedicated or VPS (Virtual Private Server) running CentOS 5.5 and above. Other similar distros might also work, but haven’t been tested yet. Your Linux distro needs to have a yum package manager.
SSH client (e.g. PuTTY on a Windows machine; Terminal on a Mac machine)
Ten minutes of your time. I was actually able to set this one up in under 4 minutes during one of the tests.
If you don’t have a server yet, don’t worry. Unless you are a very heavy-duty user, you probably won’t need a dedicated server. If you are unsure, go with a VPS.
KnowinServers (affiliate link) and diyseedbox.com teamed up to offer you an offshore VPS solution. The hosting is perfectly suitable for this tutorial and for amazingly low price of just under $9/month. It can get even cheaper with a longer commitment! For an extra $5 you can get unmetered 100 Mbps connection. The servers are located in Germany. The deal is only available by going through the link provided. Instant setup! Wow, can it get better than this?
Installation
I assume that you have obtained your server credentials (username and password) by now. Login to your server using the SSH client.
Installing prerequisites
First we are going to install a bunch of prerequisite software packages that we will need during the course of this tutorial. Issue the following command:
yum -y install gcc gcc-c++ make openssl-devel pkgconfig curl-devel perl-XML-Parser perl-libwww-perl gettext
yum -y upgrade
This installation might take a minute or two, depending on your server specs and connection speed.
Installing intltool
CentOS intltool package is out of date and a recent version is not available through the package manager. We must compile it from source. Don’t quit now. This isn’t as scary as it sounds.
cd /usr/local/src
wget -q http://ftp.gnome.org/pub/gnome/sources/intltool/0.40/intltool-0.40.6.tar.gz
tar zxf intltool-*.tar.gz
cd intltool-*
./configure –prefix=/usr
make -s
make -s install
Installing libevent
CentOS libevent package is out of date, just like intltool, so we resort to installing the latest version by hand.
cd /usr/local/src
wget -q http://monkey.org/~provos/libevent-2.0.10-stable.tar.gz
tar zxf libevent-*.tar.gz
cd libevent-*
./configure –prefix=/usr
make -s
make -s install
Installing Transmission
Transmission is the actual torrent application that you will be using. Again, just copy paste the commands into the SSH client window.
cd /usr/local/src
wget -q http://download.m0k.org/transmission/files/transmission-2.22.tar.bz2
tar xjf transmission-*.tar.bz2
cd transmission-*
./configure –prefix=/usr –disable-gtk –disable-libappindicator –disable-libcanberra –disable-gconf2 LIBEVENT_CFLAGS=-I/usr/include LIBEVENT_LIBS=”-L/usr/lib -levent”
make -s
make -s install
Add a user account for running the Transmission daemon application. You will be prompted to create a password. You will use that password to login and obtain the files that have been downloaded. Try to remember the password or write it down.
useradd -m transmission
passwd transmission
Create init script for starting the daemon. Adapted from Jason Friedland’s implementation.
wget -O /etc/init.d/transmissiond http://pastie.org/pastes/962731/download
chmod 755 /etc/init.d/transmissiond
Set the Transmission daemon to start automatically when the server is restarted:
chkconfig –add transmissiond
chkconfig –level 345 transmissiond on
Start and stop the Transmission daemon. You must do this before proceeding to the next step. This ensures that everything up to now has been installed properly. Most important, this creates a default configuration file that we will be editing later on. You should see two green [OK] outputs after the completion.
service transmissiond start
service transmissiond stop
Now we need to modify the Transmission configuration file. Replace the bold/underlined portion of the last two commands with your own username and password combination. You’ll use this to login to Transmission application.
cd /home/transmission/.config/transmission/
sed -i ‘s/^.*rpc-whitelist-enabled.*/”rpc-whitelist-enabled”: false,/’ settings.json
sed -i ‘s/^.*rpc-authentication-required.*/”rpc-authentication-required”: true,/’ settings.json
sed -i ‘s/^.*rpc-username.*/”rpc-username”: “username”,/’ settings.json
sed -i ‘s/^.*rpc-password.*/”rpc-password”: “password”,/’ settings.json
Create a directory for storing downloads:
mkdir -p /home/transmission/Downloads/
chown -R transmission.transmission /home/transmission/Downloads/
chmod g+w /home/transmission/Downloads/
Finally start the Transmission daemon for good:
service transmissiond start
Installing ConfigServer Security & Firewall application
We are also going to install a ConfigServer Security & Firewall application. This application will help your server to stay secure and also ensure that the necessary ports are open for Transmission to function properly. This is an important step, please do not skip it. Hosting providers have different configurations of the default CentOS install and may block certain ports. This installation will ensure that the necessary ports are open and unnecessary ones remain closed.
cd /usr/local/src
wget http://www.configserver.com/free/csf.tgz
tar zxf csf.tgz
rm -f csf.tgz
cd csf
./install.generic.sh
Now that we have CSF installed, we’ll issue a few commands to “doctor” the configuration file and open/close some ports.
cd /etc/csf
sed -i ‘s/^TESTING =.*/TESTING = “0″/’ csf.conf
sed -i ‘s/^TCP_IN =.*/TCP_IN = “21,22,9091,51413,30000:35000″/’ csf.conf
sed -i ‘s/^TCP_OUT =.*/TCP_OUT = “1:65535″/’ csf.conf
sed -i ‘s/^UDP_IN =.*/UDP_IN = “20,21,51413″/’ csf.conf
sed -i ‘s/^UDP_OUT =.*/UDP_OUT = “1:65535″/’ csf.conf
service csf restart
Testing your installation
By now you should have the Transmission daemon running and FTP server setup. Let’s go play!
Testing Transmission
Open the following URL in a new browser tab/window:
http://[YOUR_SERVER_IP]:9091/transmission/web/
You will be prompted to enter a username and password. Use the same username and password you have created during the Transmission installation (the second one). Once logged in, you should see a Transmission web interface. Click “Open” and copy-paste the following URL to test the download functionality and speed:
http://ftp.osuosl.org/pub/centos/5.5/isos/x86_64/CentOS-5.5-x86_64-LiveCD.torrent
You should now see the download status bar increasing.
Testing SFTP Connection
Download, install and open FileZilla. Go to File -> Site Manager. Click “New Site“. Give it a good name. Under “Host” field put the server name (if you have one), or simply the IP of the server. Choose SFTP under “Server Type“. “Logon Type” set to “Normal”. Set the user to “transmission” and the password you have created during Transmission installation (the first one). Now click “Connect“, you should see FileZilla establishing the connection and then finally listing remote directories in the right hand side part of the window. You should see “Downloads” directory, this is where all of the download files will be stored.
Setting up Transmission Remote GUI
This is my favourite part about this whole setup. Not only you get a nice and fast web based client, but you can also set this up to be used with the desktop application! If you are migrating from µTorrent, then you’ll love this!
Head over to the Transmission Remote GUI project page and download a copy of the client. Install the software.
Once you have it open:
Go to menu Torrents and select “Connect to daemon“.
Enter the server IP into the “Remote host” field. Make sure not to put the whole URL (http://….), just put the IP part (e.g. “123.45.67.89″).
Enter 9091 into the “Port” field.
Enter your username and password you have set during the Transmission installation (the second one).
Click “OK”.
Your desktop software should now be “talking” to your server. Note that this software only shows the status of the downloads, but you can’t actually access files through that UI. You still need to use the FTP client to download the completed torrents.
Updates
April 20, 2011: Trimmed yum package list, added libevent instructions, updated to Transmission 2.22.
November 2, 2010: Updated to Transmission 2.11.
October 4, 2010: Added which to the list packages to install. Some people reported that missing on their systems.
September 29, 2010: Modified the tutorial to save source code to /usr/local/src, rather than /tmp to avoid configurations with noexec on /tmp. Got rid of vsftpd FTP server all together in favour of SCP/SFTP approach (thanks to P. Callisto’s suggestion). Disabled the verbose mode on tar and silented the make.
August 30, 2010: Added libidn-devel and zlib-devel packages per Kristen’s suggestion.
August 10, 2010: Updated to Transmission 2.04.
July 7, 2010: Updated tutorial to Transmission 2.01. Added libevent-devel and libevent to yum command.(原文:1980y diyseedbox)