A lightweight, fully automatic and elegant torrent setup using RTorrent

@ 2012-08-28 by João Paulo Pizani Flor

Some time ago I installed at home a 5Mbps ADSL connection, and so I wanted to have a reliable BitTorrent setup, to enjoy the new bandwidth capacity… Besides, in the near future I will have a 50Mbps connection, and thus I felt the need for a very “optimized” and fully automatic setup for my torrent file-sharing activities :)

My idea is to use an OLD laptop that I have lying around as a dedicated seedbox, running 24/7. So, I was looking for a robust, powerful and configurable torrent client (able to run months without having to reboot), but at the same time, this client needed to use little CPU power and memory. Fortunately, I found this fantastic BitTorrent client: it’s called rTorrent, was developed in pure C++, geared towards performance and reliability, and is a nice console application.

After a lot of googling and trial-and-error, I was able to come up with a very nice rTorrent config file (.rtorrent.rc), that satisfies all my requirements for an awesome torrenting setup. These requirements are:

This config file (rtorrent.rc) is available at GitHub, and you can download it from here. After downloading the file, do the following to complete the setup:

mv [where-you-downloaded-rtorrentrc] ~/.rtorrent.rc
mkdir ~/torrent

mkdir -p ~/torrent/{session,metafiles-{in-progress,finished},content-{in-progress,finished}}

Anyways, if you want to know more in-depth what the lines in this file do, I will now make a review of each of this config file’s “sections” :)

The first line in the file tells us in which directory rTorrent stores its internal “session”. This directory should never be deleted while rTorrent is running.

Now we define the directory where rTorrent should keep downloaded data while it’s being downloaded.

The following lines define minimum and maximum limits for the number of peer connections while downloading or seeding. I obtained these numbers by “emprirical” observation during months of usage, and they work very well in my network (with a bandwidth of about 10MB/s).

The next configuration establishes that after we reach a certain “seed ratio” (in this case, 200%), the torrent should be automatically closed and removed from rTorrent’s list. This is so that you can collaborate with the spirit of file-sharing, but not indefinitely :) Besides, new downloads are not initiated with too little free disk space:

What follows are miscellaneous settings (enables DHT, cryptography, defines port range), and there’s nothing VERY special about them. The only setting which you should pay attention to is “port range”. You must set this option to a range which is open (forwarded) in case you are behind a router with NAS/firewall.

Now for a vey important section in the file: we define upload/download speed throttling depending on the time of the day. The settings which follow are the ones which I LIKE THE MOST. In my case, I want the bandwidth occupation to be smaller in the MORNINGS and EVENINGS (that’s when I am most likely at home and using the computer).

Almost done now; we say to rTorrent that it should monitor a certain directory (~/torrent/metafiles-in-progress) for the addition of files with extension *.torrent. Files added to this directory will cause the start of a corresponding download in rTorrent:

And finally, the last lines in the config file ensure that incomplete downloads have their data files removed, whenever the corresponding .torrent metafile is removed (or when the download is removed from the list in rTorrent). Besides, finished downloads are moved to a special directory (called content-finished), while the metafile itself is archived for posterity, under metafiles-finished.

So that’s all, buddies! From now on, with rTorrent installed and configured in my seedbox, I just need to throw any .torrent file inside the metafiles-in-progress directory, and leave all the rest of the work with rTorrent. It will ensure that I keep being fair to the community (by ensuring a minimal seed ratio) and then put all finished downloads in a special folder, ready for me to use them :)

If you want to get, use and adapt this configuraton file I have just shown, go again to the beginning of the post, download the file and follow the instructions…