Post updated in August 2012

This article is quite dated. My current recommendation is to use Docker.

Undoubtedly, torrent is one of the best protocols for file sharing.

For a data hoarder, it is important to have a powerful and well-configured client to handle thousands of torrents without using too much memory.

My favorite clients for Linux are Deluge, Transmission, and rTorrent. I had issues with the first one as it seemed to struggle with many files, around 600 at the time, and often crashed. The second one is simpler but very good, easy to set up, and with interfaces for Gnome and KDE. In this post, I will focus on the third one, rTorrent, which is the client I currently use and seems to be the lightest, most powerful, and with more configuration options.


ATTENTION: If you want to use Pyroscope, skip the installation of xmlrpc, libtorrent, and rtorrent. The libtorrent installation script automatically installs versions of these packages.

Installation via package manager

  1. Install rTorrent as explained in the wiki:

    sudo pacman -S rtorrent

    This is enough to have the latest stable version of rTorrent working. For many people, this is sufficient, but I prefer to run the development version.

    Another reason to compile rTorrent is to add patches, and I need it to be a version compiled with the --with-xmlrpc-c flag.

Installing dependencies

  1. Create a folder for svn:

      sudo mkdir /srv/svn
  2. Set your user as the owner of this folder:

      sudo chown -R julio.users /srv/svn
  3. Remove the programs that will be installed via svn:

      sudo pacman -R xmlrpc-c rtorrent
  4. Install CPPUNIT and libsigc++:

      sudo pacman -S cppunit libsigc++
  5. Export the PKG_CONFIG_PATH variable:

      export PKG_CONFIG_PATH
  6. Install xmlrpc-c:

      cd /srv/svn
      svn co xmlrpc-c
      cd xmlrpc-c
      sudo make install

Installation via Git


As of the first edition of this post, the rtorrent-git package did not exist in the AUR. In fact, rtorrent was maintained in SVN at the time. But to our delight, a generous community member is maintaining the package at this link: Just download and run it, the PKGBUILD already comes with the flags I use.


  1. Create a folder to keep programs downloaded with git:

    [root@julio-acer ~]# mkdir /srv/git/
    julio@julio-acer ~> cd /srv/git
  2. Clone the official libtorrent repository

    julio@julio-acer /srv/git> git clone
  3. Enter the downloaded directory and compile libtorrent

    julio@julio-acer /srv/git> cd libtorrent
    julio@julio-acer /srv/git/libtorrent> ./
    julio@julio-acer /srv/git/libtorrent> ./configure
    julio@julio-acer /srv/git/libtorrent> make
    julio@julio-acer /srv/git/libtorrent> make check
  4. Install libtorrent

    julio@julio-acer /srv/git/libtorrent> sudo make install
  5. Export the PKG_CONFIG_PATH variable

    julio@julio-acer ~> export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
  6. Clone the rtorrent repository.

    julio@julio-acer /srv/git> git clone
  7. Compile rtorrent with the xmlrpc option (required by some interfaces)

    julio@julio-acer /srv/git/rtorrent> ./
    julio@julio-acer /srv/git/rtorrent> ./configure --with-xmlrpc-c
    julio@julio-acer /srv/git/rtorrent> make
  8. Install rtorrent

    julio@julio-acer /srv/git/rtorrent> sudo make install

Installation via SVN

UPDATE: The development of rtorrent has been moved to git, and svn is just a mirror, so prefer installation via git, as explained above.

  1. Install libtorrent:

    cd /srv/svn
    svn co svn:// rtorrent
    cd rtorrent/libtorrent
    sudo make install
    sudo ldconfig
  2. Install rtorrent:

    cd ../rtorrent
    ./configure - -with-xmlrpc-c (perceba os dois traços antes de with)
    sudo make install

rTorrent Configuration

The configuration is done through the file “~/.rtorrent.rc”. Through it, we can configure rTorrent to:

  • Use a specific range of ports
  • Limit download/upload speed
  • Watch a folder and download all .torrent files from it
  • Run a script after download completion
  • and much more…

On my notebook, the setup is as follows:

  • Everything is saved on an external hard drive, which is always connected

  • In the folder /media/externo/Downloads/Torrents/rtorrent/watch, there are other folders

    • Ebooks » Contains .torrent files for ebooks
    • Movies » Contains .torrent files for movies
    • Music » Contains .torrent files for albums
    • TV Shows » Contains .torrent files for TV series
    • Misc » Contains .torrent files for all other categories

These folders are constantly monitored by rTorrent. When I add a .torrent file to any of them, it automatically starts downloading to the folder /media/externo/Downloads/Torrents/leeching/{Ebooks,Movies,Misc,Music,TV Shows}/

After the download is complete, the files are moved to the folder /media/externo/Downloads/Torrents/seeding/{Ebooks,Movies,Misc,Music,TV Shows}/

  • Create the folders:

    mkdir \
      /media/externo/Downloads/Torrents/leeching/{Ebooks,Filmes,Misc,Musicas,Seriados,Programas} \
      /media/externo/Downloads/Torrents/seeding/{Ebooks,Filmes,Misc,Musicas,Seriados,Programas} \
      /media/externo/Downloads/Torrents/rtorrent/sessions \

I decided to keep the sessions and watch folders on the external hard drive so that I can connect it to another computer with rtorrent installed and continue transfers without any issues. To download something with the external hard drive disconnected, a modified .rtorrent.rc file will be needed, as it won’t find the sessions folder or initialize.

My .rtorrent.rc can be found on GitHub. Much of it was taken from here.

Magnet URI

rTorrent 0.8.9

You will need to enable DHT.

Save the following script somewhere (using ~/Scripts/ here):


cd /media/externo/Downloads/Torrents/rtorrent/watch/Misc
[[ "$1" =~ xt=urn:btih:([^&/]+) ]] || exit;
echo "d10:magnet-uri${#1}:${1}e" > "meta-${BASH_REMATCH[1]}.torrent"
julio@julio-acer ~> ~/Scripts/ \

This command will create the file meta-1234567890.torrent in your folder.


Using rTorrent only with the ncurses interface is a bit complicated. A good solution is to install a Web GUI.

Here I am using ruTorrent, similar to the interface of µtorrent, which allows me to manage torrents via the web. For this, it is necessary to configure Apache and PHP first.

Part of the steps were taken from the ArchLinux forum and the ruTorrent wiki.

RuTorrent: Installation via package manager

  1. Download ruTorrent available on AUR

  2. Download mod_scgi

  3. Download ruTorrent-plugins

  4. Install geoip

    sudo pacman -S php-geoip
  5. Change permissions of the folder

    sudo chmod 777 -R /srv/http/rutorrent/
  6. Edit Apache settings (/etc/httpd/conf/httpd.conf):

    Listen 80
    Adicione ao final da sessão LoadModule:
    LoadModule scgi_module modules/
    LoadModule php5_module modules/

    After # Various default settings add a new section:

    # php5
    Include conf/extra/php5_module.conf
    Adicione ao final do arquivo:
    SCGIMount /RPC2
  7. Protect the ruTorrent directory with a password

    1. Create a password using htpasswd:

      julio@julio-acer ~> htpasswd -c /home/julio/rtorrent/.htpasswd julio
      New password:
      Re-type new password:
      Adding password for user julio
    2. In Apache:

      <directory /srv/http/rutorrent/>
      AuthName "Log In"
      AuthType Basic
      AuthUserFile /home/julio/rtorrent/.htpasswd
      AuthGroupFile /dev/null
      require user julio
  8. In /etc/php/php.ini:

    1. Uncomment in html_errors:

      • log_errors
      • Default Value: On
    2. Uncomment in Dynamic Extensions:

    3. Leave the open_basedir similar to:

      open_basedir = /usr/bin/:/usr/local/bin/:/srv/http/:/home/:/tmp/:/usr/share/pear/:/media/external/Downloads/Torrents
  9. In /etc/php/conf.d/geoip.ini, uncomment:
  10. Restart the server

    # /etc/rc.d/httpd restart
  11. Test the installation at http://localhost/rutorrent/

Installation via SVN

  1. Just checkout the repository

    cd /srv/svn
    svn co rutorrent
  2. Configure as usual


ruTorrent has some very useful plugins. I recommend the following plugins:


Allows limiting the download and/or upload speed per torrent group.

julio@acer http/rutorrent/plugins> sudo svn co


Allows stopping uploading a torrent after reaching a certain ratio.

julio@acer http/rutorrent/plugins> sudo svn co

Track Labels

Adds a label with the tracker name to each torrent.

julio@acer http/rutorrent/plugins> sudo svn co


PyroScope contains various command-line tools and some patches that greatly enhance the use of rTorrent. You do not need to install rTorrent as explained above, as the PyroScope script installs a special version of rTorrent, the rTorrent-extended.


The easiest way is through

Another easy way to install pyrocore would be with pip (sudo pip2 install pyrocore), but the version there is very outdated.

The same goes for the version available on AUR.

There is another version that seems to be more up to date, but I haven’t tested it.

On the project page, there is a tutorial on how to install everything from the source code. Here I will only try to explain more clearly how to install, but I recommend checking the official website for more complete and updated information.

  1. Install dependencies

    julio@acer ~> sudo pacman -S tmux python-virtualenv
  2. Install rTorrent-extended

    julio@julio-acer ~> mkdir ~/src; cd ~/src
    julio@julio-acer ~/src> svn co
    julio@julio-acer ~/src> cd rtorrent-extended
    julio@julio-acer ~/src/rtorrent-extended> ./ all
    julio@julio-acer ~/src/rtorrent-extended> ./ extend
  3. Install Pyroscope

    julio@julio-acer ~> svn checkout ~/lib/pyroscope

    If you are on Arch Linux, edit the path to python2 in the file ~/lib/pyroscope/


    Run the script:

    julio@julio-acer ~> ~/lib/pyroscope/

    Add ~/bin to the $PATH. Add the following line to .zshrc and .bashrc:

    export PATH="$HOME/bin:$PATH"

    Run the script to convert your .rtorrent.rc to the new syntax:

    julio@julio-acer ~> ~/lib/pyroscope/pyrocore/docs/rtorrent-extended/ ~/.rtorrent.rc

    Add to ~/.rtorrent.rc:

    ## PyroScope SETTINGS
    method.insert = pyro.extended, value|const, 1
    method.insert = pyro.bin_dir, string|const,
    method.insert = pyro.rc_dialect, string|const|simple, "execute.capture=bash,-c,\"test $1 = 0.8.6 && echo -n 0.8.6 || echo -n 0.8.9\",dialect,$system.client_version="
    method.insert = pyro.rtorrent_rc, string|const|private, "$cat=~/.pyroscope/rtorrent-,\"$pyro.rc_dialect=\",.rc.default"
    import = $pyro.rtorrent_rc=
    schedule = pyro_watchdog,30,300,"pyro.watchdog=~/.pyroscope,"
    # Show traffic of the last hour
    network.history.depth.set = 112
    schedule = network_history_sampling,1,32, network.history.sample=
    method.insert = network.history.auto_scale.toggle, simple|private, "branch=network.history.auto_scale=,\"network.history.auto_scale.set=0\",\"network.history.auto_scale.set=1\""
    method.insert = network.history.auto_scale.ui_toggle, simple|private, "network.history.auto_scale.toggle= ;network.history.refresh="
    branch=pyro.extended=,"schedule = bind_auto_scale,0,0,\"ui.bind_key=download_list,=,network.history.auto_scale.ui_toggle=\""

    Run the script to create a configuration:

    julio@julio-acer ~> pyroadmin --create-config
  4. Test the installation

    julio@julio-acer ~> which rtorrent
julio@julio-acer ~> rtorrent

The screen should be colored. Press * to switch between collapsed view and expanded view.

More tips can be found here

Note: If you open rTorrent with GNU Screen and it complains about the number of colors in your terminal, add the following line to ~/.screenrc: term screen-256color.

I’ve had issues with the installation script due to version compatibility problems. In this case, you would need to downgrade several programs and run the script again.

Creating .torrent with mktorrent

In addition to downloading, sharing your files is also important. Keeping with the Unix program philosophy of simplicity, rtorrent does not have the function to create torrents.

For this task, I use mktorrent.

  1. Download mktorrent

    julio@julio-acer ~ $ sudo pacman -S mktorrent
  2. Move all files to be shared to a separate folder.

  3. Run the command with the appropriate parameters and options

    mktorrent -v -p -a="ANNOUNCE" -c="COMMENT" -n="NAME" -o="OUTPUT.torrent"


    • -v Verbose
    • -p makes the torrent private
    • ANNOUNCE is the URL provided by the tracker
    • COMMENT is a comment about the torrent
    • NAME is the package name, which will be in the metainfo. It’s better to leave it empty to avoid changing folders.
    • OUTPUT is the name of the .torrent file


    $ mktorrent -v -p -a "http://tracker.url/announce.php?passkey=123456xxxx&uid=xxxxx" -n "Artista - Ano - Album" -c "Original Release" -o album.torrent "Pasta_Ano - Disco"
    mktorrent 1.0 (c) 2007, 2009 Emil Renner Berthing
    Announce URLs:
    1 : http://tracker.url/announce.php?passkey=123456xxxx&uid=xxxxx
    Torrent name: Artista - Ano - Album
    Metafile: /media/externo/Musicas/album.torrent
    Piece length: 262144
    Be verbose: yes
    Write date: yes
    Web Seed URL: none
    Comment: "Original Release"
    Adding cover.jpg
    Adding 01 - Track01.flac
    Adding 02 - Track02.flac
    Adding 03 - Track03.flac
    Adding 04 - Track04.flac
    Adding 05 - Track05.flac
    Adding Artist - Album.log
    Adding Album.cue
    236381529 bytes in all.
    That's 902 pieces of 262144 bytes each.
    Hashed 902 of 902 pieces.
    Writing metainfo file… done.

If we try to use the same command to cross-seed, meaning to upload the same files to different trackers, rtorrent will return the error “Info hash already used by another torrent.” To solve this problem by making the hashes different, it can be done in the following ways:

  1. Add or modify a file when creating the second .torrent

  2. Set a different size for each piece using the -l parameter. Example:

    mktorrent -v -p -a "http://tracker.url/announce.php?passkey=123456xxxx&uid=xxxxx" -l 19 -o album_tracker2.torrent "Year_Folder - Disc"

Uses 512kb for each piece.

ruTorrent also allows for multi-user configuration, keeping each user’s files in specific folders (rutorrent/share/users/USERNAME/settings/).


Julio Batista Silva
Julio Batista Silva
Data Engineer

I’m a computer engineer passionate about science, technology, photography, and languages. Currently working as a Data Engineer in Germany.

comments powered by Disqus