Saturday, January 5, 2008

How to set up rtorrent on CentOS

This is a very nice tutorial taken from FileSharingtalk written by "fstokebanget"(Not me!).

In this tutorial we'll install this package into the box :
pkg-config
openSSL
nCurses
libsigc++
libCurl
libTorrent and rTorrent
screen or dtach

That's all. Note that the whole process is relatively *very* long, depends on your seedbox processor.

Before you can connect to your seedbox you need either putty if you're on Windows, and terminal if you're on unix based machine include Mac OS X. Since I'm on Mac OS X I just launch the terminal and connect to the server using this command :

ssh xxx.xxx.xxx.xxx -l login_name

where : xxx.xxx.xxx.xxx = your seedbox IP address
login_name : usually as root

Now you're connected to your server. Ready? Follow these step by step instructions.

pkg-config

Let’s start by pkg-config, as it is needed for other softwares to check whether a library is installed or not. The installation is trivial and shouldn’t cause any difficulties.

# cd /tmp/
# wget http://pkgconfig.freedesktop.org/rel...ig-0.22.tar.gz
# tar -zxvf pkg-config-0.22.tar.gz
# cd pkg-config-0.22
# ./configure
# make
# make install

openSSL

# wget http://www.openssl.org/source/openssl-0.9.8g.tar.gz
# tar -zxvf openssl-0.9.8g.tar.gz
# cd openssl-0.9.8g
# ./Configure gcc
# make
# make install

ncurses

A programming API to build text interfaces…

# wget http://ftp.gnu.org/pub/gnu/ncurses/ncurses-5.6.tar.gz
# tar -zxvf ncurses-5.6.tar.gz
# cd ncurses-5.6
# ./configure
# make
# make install

libsigc++

A C++ library…

# wget http://ftp.gnome.org/pub/GNOME/sourc...-2.0.17.tar.gz
# tar -zxvf libsigc++-2.0.17.tar.gz
# cd libsigc++-2.0.17
# ./configure
# make
# make install

libCurl

Library that provides URL transferts.

# wget http://curl.haxx.se/download/curl-7.16.4.tar.gz
# tar -zxvf curl-7.16.4.tar.gz
# cd curl-7.16.4
# ./configure
# make
# make install

if by some reason you can't connect to curl.haxx.se, just google for the files or go here and find the files : http://files.directadmin.com/services/customapache/

libTorrent

libTorrent is rTorrent’s engine.

do this first

export PKG_CONFIG_PATH=/usr/local/ssl/lib/pkgconfig/

Then grab libTorrent and compile it:

# wget http://libtorrent.rakshasa.no/downlo...-0.11.9.tar.gz
# tar -zxvf libtorrent-0.11.9.tar.gz
# cd libtorrent-0.11.9
# ./configure
# make
# make install

rTorrent

Almost there.

# wget http://libtorrent.rakshasa.no/downlo...t-0.7.9.tar.gz
# tar -zxvf rtorrent-0.7.9.tar.gz
# cd rtorrent-0.7.9
# ./configure
# make
# make install


Now you can try to launch rtorrent. Type rtorrent.

dtach / screen

One thing a bit stupid now is that you can use rTorrent, but it terminates as soon as you close you terminal. Sure you can run it in the background in using rtorrent &, but then you can’t see the GUI anymore. The solution is a terminal multiplexer, which allows you to access multiple terminal sessions. That’s pretty good: you can start rTorrent from one computer with either dtach or screen, leave the session, and then get your window from another computer. Exactly what we need.

screen is better than dtach, but it's up to you.

if you want to install dtach, do this :

# wget http://jaist.dl.sourceforge.net/sour...ach-0.7.tar.gz
# ./configure
# make
# cp /tmp/dtach-0.7/dtach /bin/

Then you will use dtach and rtorrent this way:

dtach -c /tmp/socket-rtorrent rtorrent

to leave the session just hit Ctrl+\
to go back to your session type
dtach -A /tmp/socket-rtorrent rtorrent

if you want to install screen do this :

#yum install screen

after it's done, to start rtorrent type :
screen rtorrent

to leave the session hit Ctrl+a then press d
to go back to your session just type
screen -r

rTorrent may need the configuration file .rtorrent.rc, if you feel you need to use, you could find it on google. Or here you can find the .rtorrent.rc sample made by filonome :
http://filesharingtalk.com/vb3/p-any...97/postcount11
* remember to change the max_memory_usage to the best value that suites you, I have 1GB RAM, i enter 768000000 here

The first time running rTorrent, you'll be a little confused as there are no toolbars or buttons. rTorrent is used through keyboard shortcuts. These are the basic keys for using rTorrent:

Load a torrent - backspace (use TAB to auto-complete torrent name)
Select items - up/down arrow
Switch to torrent/download view - left/right arrow
Quit - Ctrl + q

Increase the upload speed limit by 1/5/50 KB - a/s/d
Decrease the upload speed limit by 1/5/50 KB - z/x/c
Increase the download speed limit by 1/5/50 KB - A/S/D (shift + a)
Decrease the download speed limit by 1/5/50 KB - Z/X/C


In download view :
Adjust uploads no - 1/2
Adjust min peers no - 3/4
Adjust max peers no - 5/6
Adjust file priority (in File list) - spacebar for single file / * (shift+8) for all files


For more control keys, you can find the link below.

Maybe at this point you're asking about how to upload the torrent files into your seedbox. It's easy, if you're using Mac OS X, it's all in your terminal, just use this command to established an ssh ftp session to your seedbox :
sftp login_name@xxx.xxx.xxx.xxx
login_name : usually root
xxx.xxx.xxx.xxx : your seedbox address same as the ssh command above

after enter the sftp, just use :
put your_torrent_file_name . (this period is include in the command)
e.g : put Desktop/Stargate.The.Ark.Of.Truth.2008.XViD.torrent .
this will put file Stargate.The.Ark.Of.Truth.2008.XViD.torrent into your seedbox home folder


Sometimes you have a tracker that has no passkey, this often have to login from the location you want to leech/seed. If you use linux you probably have question about this, don't worry, it's easy, all you need to do is create a dynamic tunnel over SSH to your server. Once created, the dynamic tunnel would act as a SOCKS5 proxy allowing you to browse the web using your servers IP, many thanks to Fibre, if you're a Windows user you could follow his quick tutorial here : http://filesharingtalk.com/vb3/p-hos...84/postcount17
If you're on Mac or Unix system, connect to your server using this additional option in command line :
ssh xxx.xxx.xxx.xxx -l login_name -D yyyyy
yyyyy : the port number you desire
the rest is the same as above

and from your browser, point the SOCKS Proxy to 127.0.0.1 with the same port number as you set in the ssh command the don't forget to bypass or set no proxy to localhost and 127.0.0.1

some references that you may need :
rtorrent user guides
http://libtorrent.rakshasa.no/wiki/RTorrentUserGuide

reviews about rtorrent
http://en.linuxreviews.org/RTorrent

SSH Terminal service commands
http://www.h3c.com/portal/Technical_...446_1285_0.htm

How to keep remote console session running
http://www.nslu2-linux.org/wiki/HowT...SessionRunning

This is a good reading about how to use rtorrent like a pro
http://kmandla.wordpress.com/2007/05...nt-like-a-pro/

don’t miss these nifty rtorrent features, such as Watch a directory for torrents
http://libtorrent.rakshasa.no/wiki/RTorrentCommonTasks

4 comments:

mak said...

excellent post, thanks, i was trying to get it to compile on my poor beaten centos 4.6 (thanks to godady) and your instructions were the only thing that worked

Dead Format said...

Thank you so much for writing this up, I was having a hell of a time getting rtorrent installed on my centos box. You're the best!

Anonymous said...

the latest CentOs is not including a C Compiler. You may want to add a new 1st step of issuing the command

yum -y install gcc

worked for me (well so far at least, not done installing all the packages.)

s2cuts said...

As of this writing compilation of rTorrent fails with a segfault due to gcc. Using gcc4 will fix.

yum install gcc4-c++
export CC=gcc4
export CXX=g++4