rTorrent & libTorrent: Installing On Linux

courtesy of Vazhin.

Since rTorrent is now the recommended Linux client on many trackers, it’s time for a tutorial to help those not so familiar with installing stuff on Linux. This will cover everything you need to get rTorrent up and running.

You might be able to get everything you need from your distro’s official repositories, but there are too many distros for me to cover how to do that, and most of the time they contain extremely outdated versions. So I’ll show you how to compile and install the newest versions.

For this tutorial, I will assume that you already have new enough versions of the standard software/libraries needed to compile and install programs on Linux, such as GCC/G++, pkg-config, OpenSSL, automake, etc. Sorry, I will not cover how to upgrade/install these, but your distro’s official repositories should have all of these (even if they are not the latest versions, they should still work).

Before you start, make sure you are logged in or SU’d to root. If you don’t know what this is then learn more about Linux before continuing.

Prerequisites

First of all, install the prerequisites for rTtorrent. At the time of this writing, they are:

  • * libsigc++ >= 2.0.
  • * libcurl >= 7.12.x

1) Head over to the libsigc++ official website (http://libsigc.sourceforge.net/stable.shtml) and download the sources.

root@beast:~# wget
http://ftp.gnome.org/pub/GNOME/sources/libsigc++/2.0/libsigc++-2.0.18.tar.gz

2) Extract the files

root@beast:~# tar zxf libsigc++-2.0.18.tar.gz

3) Compile and install libsigc++

root@beast:~# cd libsigc++-2.0.18
root@beast:~/libsigc++-2.0.18# ./configure
root@beast:~/libsigc++-2.0.18# make
root@beast:~/libsigc++-2.0.18# make install
root@beast:~/libsigc++-2.0.18# cd ..

4) Now you need to install libcurl. Compiling it with c-ares support is recommended so rtorrent doesn’t hang on hostname lookups. So first go to the c-ares page (http://daniel.haxx.se/projects/c-ares/), dl, extract, compile and install.

root@beast:~# wget http://daniel.haxx.se/projects/c-ares/c-ares-1.4.0.tar.gz
root@beast:~# tar zxf c-ares-1.4.0.tar.gz
root@beast:~# cd c-ares-1.4.0
root@beast:~/c-ares-1.4.0# ./configure
root@beast:~/c-ares-1.4.0# make
root@beast:~/c-ares-1.4.0# make install
root@beast:~/c-ares-1.4.0# cd ..

5) Now go to the curl page (http://curl.haxx.se) and do the same, but make sure you configure it with c-ares support. (If haxx is down, use their mirror: http://curl.signal42.com/download/curl-7.17.1.tar.gz).

root@beast:~# wget http://curl.haxx.se/download/curl-7.17.1.tar.gz
root@beast:~# tar zxf curl-7.17.1.tar.gz
root@beast:~# cd curl-7.17.1
root@beast:~/curl-7.17.1# ./configure –enable-ares
root@beast:~/curl-7.17.1# make
root@beast:~/curl-7.17.1# make install
root@beast:~/curl-7.17.1# cd ..

libtorrent and rtorrent

libtorrent and rtorrent go hand in hand. Each one has to be installed with the other, and libtorrent must be installed before rtorrent. You must install both each time you decide to upgrade rtorrent.

1) Go to the official site (http://libtorrent.rakshasa.no) and dl both stable source archives.

root@beast:~# wget
http://libtorrent.rakshasa.no/downloads/libtorrent-0.11.8.tar.gz
root@beast:~# wget http://libtorrent.rakshasa.no/downloads/rtorrent-0.7.8.tar.gz

2) Install libtorrent

root@beast:~# tar zxf libtorrent-0.11.8.tar.gz
root@beast:~# cd libtorrent-0.11.8
root@beast:~/libtorrent-0.11.8# ./configure
root@beast:~/libtorrent-0.11.8# make
root@beast:~/libtorrent-0.11.8# make install
root@beast:~/libtorrent-0.11.8# cd ..

3) Install rtorrent

root@beast:~# tar zxf rtorrent-0.7.8.tar.gz
root@beast:~# cd rtorrent-0.7.8
root@beast:~/rtorrent-0.7.8# ./configure
root@beast:~/rtorrent-0.7.8# make
root@beast:~/rtorrent-0.7.8# make install
root@beast:~/rtorrent-0.7.8# cd ..

Installation is complete now. Exit out of root.

Configuring rtorrent

The rtorrent settings file is .rtorrent.rc in your home dir. rtorrent is highly customizable and there are many options. To get a list of all of them read the man page (man rtorrent) and check out the documentation on the web site. Just create a new file called .rtorrent.rc in your home dir and put your settings in there. Here are a few settings you absolutely must have for optimal performance:

session = ~/.rtorrent
port_range = 31600-31610
encryption = allow_incoming,enable_retry,try_outgoing

quick synopsis of these settings:

session = ~/.rtorrent - this will store torrents and torrent data in ~/.rtorrent so in case rtorrent crashes or you need to restart it, your stats will be kept. You can change this to whatever dir you want. Just make sure that the directory exists.

port_range = 31600-31610 - the port range that rTorrent will listen on. rTorrent by default listens in 6881-6889 which is blocked by most ISPs, so this is absolutely necessary.

encryption = allow_incoming,enable_retry,try_outgoing - optimal encryption settings which will try to establish an encrypted connection and if it’s not possible, fail over to unencrypted/legacy.

That’s all there is to it! I suggest printing out the key bindings section of the man page for easy reference. at first it looks arcane and confusing, but after a few days of using rtorrent exclusively, all the keystrokes will become second nature! It should be noted that you don’t need superuser privileges for any of the steps above, just install to your home directory: ./configure –prefix=$HOME

TIP:

http://libtorrent.rakshasa.no/wiki/Install

Just install the depensomethings from your repositories and then follow the installation guide.