Building a dedicated download system with rTorrent
Your old computer might still be useful as a dedicated download box.
Before you throw away the old PC in your basement, you might be wondering whether you can find another use for it. An out-of-date computer that is too light for today's GUI universe still has value – if you can find the right job for it. I put my old PC to work as a BitTorrent-ready download slave that spends its cycles on fetching large files so my production systems can worry about other tasks.
All you need is a light Linux distribution that fits on your old computer, a torrent client, and a few other tools to control and manage the system.
The computer I am using as my download slave (remote computer) is a Pentium 2 with a clock speed of 500MHz and 96MB of SDRAM. For the example in this article, I will use Debian Linux, but you can use any Linux distribution supported by the hardware.
To begin, download the minimal Debian net install image from the Debian website  and install the image on the old system by any suitable method (network boot, CD install, GRUB image mount – look online for more on Debian installation options ).
The next step is to set up a torrent client for the system. Linux offers a number of torrent alternatives. In this case, I opted for functionality over simplicity and chose rTorrent . rTorrent (Figure 1) is a command-line torrent client for Linux that uses nCurses for the menus and interface and libTorrent as a back end.
The main advantage of rTorrent, in this case, is its small memory footprint. Unlike popular GUI clients such as Azureus or Deluge, rTorrent uses very little memory when downloading torrents. Additionally, rTorrent is very easy to control over the network.
Setting Up the SSH Daemon
The next step is to install SSH so you can control the remote slave over the network. To set up SSH on Debian and make it run every time the computer boots, enter the following commands (as root):
apt-get install ssh -y update-rc.d ssh defaults
Also, you can start the server manually with the following line:
Just remember that you will have to install and configure SSH on both systems. Now edit the file /etc/ssh/ssh_config to enable the following options (just uncomment them from the default file or add them if necessary):
Protocol 2 PermitRootLogin no
Then make sure you add the following option to the /etc/hosts.allow file:
This option will allow all the connections to and from the host and remote systems. At this point you can access this computer over the network with SSH.
To connect to the remote computer, issue this command on the master:
ssh -l userName IpofTheRemoteSystem
If you don't know the IP address of the remote PC, you can get it by issuing the ifconfig command on the remote system. If it isn't possible to obtain the IP address that way, you might need to improvise a way to address the remote computer (see the box titled "But I Have a Dynamic IP Address").
But I Have a Dynamic IP address
It isn't always possible to obtain the IP address of a remote computer. If you want to access a remote system that doesn't have a static IP address, you will need to find a workaround. Several strategies have evolved for supporting connections to computers with dynamic addresses. The no-ip.org website, for instance, lets you create a hostname that points to your dynamic IP address.
An account on the no-ip.org website is free. Once you set up your account, click on Hosts/Redirects in the user control panel. The free account only supports up to five free redirects. Now add a redirect. The default account type should be fine in this case. By default, all firewalls and ISPs block the common ports for security reasons. Check your router configuration and open the port you are using to run SSH (22 in this case). Also, open the port from the firewall if you are using a firewall on your system. With the free CanYouSeeMe.org online service , you can check to see whether a connection attempt is possible through the SSH port. Just enter the port you want to check.
The hostname you just set up needs to track the changes in the IP of the remote machine. See the no-ip documentation  for information on setting up the no-ip script, which updates the dynamic IP and binds it with your domain.
Now that your SSH connection is working, you can move on to setting up rTorrent on the remote system. If you are new to torrents and downloading, Wikipedia has some useful background information on the BitTorrent protocol . When accessing your rTorrent client, I recommend you use the Screen window manager. Screen is a full-screen window manager that lets you multiplex a physical terminal between several processes, which means you can put the program in the background easily; plus, you'll have some protection against accidentally closing the application.
Next, create a file called .rtorrent.rc in your home directory (touch ~/.rtorrent.rc). To start, you can download a sample rtorrent rc file  and save it to ~/.rtorrent.rc. Before editing the file, create the ~/.rtorrent directory and other supporting directories:
mkdir -P ~/.rtorrent/sessions/
The sessions directory will save the status and the torrent files of the torrents you are currently downloading, which saves you from having to check the hash every time you start rTorrent. The sample RC file is self-explanatory – just uncomment the settings you want to override and change the default values. For example, you can set the default upload or download speed.
Once you've configured all the necessary options, save that file. Although you can start using your download box anytime, I suggest you read on for some additional tips on configuring your system.
Even though rTorrent is a great piece of software, it has some downsides. Problems include an inability to queue the torrents, no option to prioritize the first or last piece of a torrent, and no option to add a new tracker. A few changes to your configuration will improve your rTorrent experience.
First create the watch directory. rTorrent will monitor this directory to check for any new torrents to add:
Then edit your rtorrent.rc file and add following lines of code to the file:
schedule = watch_directory,10,10,load_start=~/.rtorrent/watch/*.torrent schedule = tied_directory,10,10,start_tied= schedule = untied_directory,10,10,close_untied=
These lines tell rTorrent to start the torrents that are added to the watch directory automatically. The directory will be checked every 10 minutes. Any torrents already added will resume, and the system will remove any torrents that have been deleted from the watch directory.
Additionally, you can add a few more options to create symbolic links, which will monitor the status of the torrents and will move the completed downloads to a directory you specify once the download is complete. To create the symbolic links in the watch directory, add the following lines to the rtorrent.rc file:
on_start = link1, "create_link=tied,,.started" on_stop = link1,"delete_link=tied,,.started" on_finished = link1,"create_link=tied,,.finished" on_erase = link1,"delete_link=tied,,.finished"
The following line moves the completed downloads to the location you desire:
on_finished = move_complete,"d.set_directory=~/Download/ ;execute=mv,-u,$d.get_base_path=,~/Download/"
Just replace ~/Downloads with the directory you put your downloaded files.
If you don't have unlimited Internet bandwidth, you might want to stop downloading at certain times (e.g., the non-free hours). By adding the following lines to your rtorrent.rc file, you can schedule your download time:
schedule = throttle_1,01:00:00,24:00:00,download_rate=0 schedule = throttle_2,05:00:00,24:00:00,download_rate=25 # Format of this is, #schedule = throttle_x,startTime,finishTime,download_rate=rateInkBps
Now that the necessary infrastructure is in place, you can put your download system to work.
Should you trust an online service to store your online passwords?
New B+ board lets you build cool things without the complication of a powered USB hub.
Redmond rushes in to root out alleged malware haven.
New initiative will bring futuristic virtual reality effects to the web surfing experience.
Dyreza malware launches a man-in-the-middle attack that compromises SSL.
New cloud combines worldwide access with local attention to data security.
A first cousin of the recent Heartbleed attack affects EAP-based wireless and peer-to-peer authentication.
FOSS community acts to protect freedom of choice for laptop devices.
Quintessential open source browser shores up its market share with a step toward the proprietary dark side.
Authorities in 16 countries take action against users of the imfamous BlackShades malware tool.