Tuesday, 26 August 2008

rTorrent, light and fast bittorrent client.

I use two torrent clients almost every day, Transmission on my own box with a gnome desktop, and for a long time now rTorrent in a shell via SSH to a spare machine I have use of on a separate connection. Setting up rTorrent on an Ubuntu machine is what I am going to discuss here.

First step is to install the program, open a terminal and enter:

sudo apt-get install rtorrent

Or use Synaptic and search for 'rtorrent', install it. A basic config file is located /usr/share/doc/rtorrent/examples for you to tweak to your own liking, at its simplest you may want to change the download folder in it and the 'watch' folder. The watch folder is a place that rTorrent will monitor for *.torrent files coming into so it can automatically start, and when the download has completed and achieved a ratio you are happy with, you can just delete the torrent file from this folder to remove it from rTorrent. Dead simple stuff :]

cp /usr/share/doc/rtorrent/examples/rtorrent.rc ~/.rtorrent.rc

then edit this file with your prefered text editor, mine is usually nano, use gedit if you prefer a GUI editor:.

cd ~/
nano .rtorrent.rc

Now we can make the most basic of changes, first up is the download folder, look for the line:

# Default directory to save the downloaded torrents.

change the line after it to the folder you want to be your download folder and remove the # so you have something like this:

# Default directory to save the downloaded torrents.
directory = ~/torrents

This makes my download folder /torrents/ in my home, the default without editting is simply your home folder which you may be happy with.

Next lets tell it what folder to watch for torrent files. I have defined mine to be this same ~/torrents/ folder, you may prefer to leave it as your home folder. Either way find these lines just slightly down from the previous:

# Watch a directory for new torrents, and stop those that have been
# deleted.
schedule = watch_directory,5,5,load_start=~/torrents/*.torrent
schedule = untied_directory,5,5,stop_untied=

Yours will look very slightly different as I have shown how I changed mine to watch the ~/torrents/ folder. You should now save the file and close the editor, ctrl+o to save in nano if you used my prefered editor from above and don't know it, press enter to save wit hthe same name, then ctrl+x to close it.

You should now be free to start rTorrent with the command:

rtorrent

Not very impressive at first look is it, but download a torrent file to the watch folder and see rtorrent leap into action all by itself. You can adjust the upload and download speeds using the keys

a/s/dIncrease the upload throttle by 1/5/50 KB.
z/x/cDecrease the upload throttle by 1/5/50 KB.
A/S/DIncrease the download throttle by 1/5/50 KB.
Z/X/CDecrease the download throttle by 1/5/50 KB.


There are other keys to pause and resume torrents and many other facilities that you may require, for that I would point you at the User Guide page at http://libtorrent.rakshasa.no/wiki/RTorrentUserGuide


As I use this remotely I also run it inside a screen so I can safely detach from it and break the connection leaving it running on the remote machine, to do this enter in a terminal:

screen

then you will just see another command prompt on a clear terminal at which point enter:

rtorrent

rTorrent will start as normal but if you use the keys ctrl+a then d it will detach, that is it will drop you back at your original shell, leaving rtorrent running in the backgroun still. You can attach to it again with:

screen -r

You can then see rTorrent again to check your downloads or ratios. Check 'man screen' for more help on using screen, there are a *lot* of things you can do with it, and that might be a worthwhile post for me some time soon.

No comments: