BitTorrent (FEDORA)


BitTorrent (FEDORA)

The BitTorrent protocol implements a hybrid client/server and P2P (page 1047) file transfer mechanism. BitTorrent efficiently distributes large amounts of static data, such as the Fedora installation ISO images (page 35). It can replace protocols such as anonymous FTP, where client authentication is not required. Each BitTorrent client that downloads a file provides additional bandwidth for uploading the file, thereby reducing the load on the initial source. In general, BitTorrent downloads proceed faster than FTP downloads.

Unlike protocols such as FTP, BitTorrent groups multiple files into a single package called a torrent. For example, you can download the Fedora Core ISO images, together with the release notes and MD5 values, as a single torrent.

BitTorrent, like other P2P systems, does not use a dedicated server. Instead, the functions of a server are performed by the tracker, peers, and seeds. The tracker allows clients to communicate with each other. A clientcalled a peer when it has downloaded part of the torrent and a seed once it has downloaded the entire torrentacts as an additional source for the torrent. As with a P2P network, each peer/seed that downloads a torrent uploads to other clients the sections of the torrent it has already downloaded. There is nothing special about a seed: It can be removed at any time once the torrent is available for download from other seeds.

The first step in downloading a torrent using BitTorrent is to locate or acquire a .torrent file. Such a file contains pertinent information about the torrent, such as its size and the location of the tracker. You can obtain a .torrent file by accessing its URI (page 1061), or you can acquire it via the Web, an email attachment, or other means. The BitTorrent client can then connect to the tracker to learn the locations of other clients that it can download the torrent from.

Once you have downloaded a torrent, it is good manners to allow BitTorrent to continue to run so other clients can upload at least as much information as you have downloaded.

Prerequisites

Use whereis to determine whether bittorrent-curses is installed on the local system. If it is not installed, use yum (page 478) to install the bittorrent package. Because BitTorrent is written in Python and runs on any platform with a Python interpreter, it is not dependent on system architecture. (The noarch in the name of the rpm file stands for "no architecture.") Python is installed in /usr/bin/python and is available in the python package.

The BitTorrent program, bittorrent-curses, is a textual client that provides a pseudographical interface. Complementing bittorrent-curses, other clients provide additional features. Some of these clients are available on sourceforge.net.

Using BitTorrent

Copy the .torrent file for the torrent you want to download to the working directory. For example, to obtain the .torrent file for Fedora Core, point a browser at torrent.fedoraproject.org. (See page 35 for information about burning installation CDs from ISO images.) Select the release (e.g., Fedora Core 5), architecture (e.g., i386), and the format (CD unless DVD is specified in the name of the torrent). Download the .torrent file (it is usually less than 300 kilobytes); it will have a name something like bordeaux-binary-i386.torrent. With the .torrent file in the working directory, the simplest command you can use to download the torrent is

$ bittorrent-curses bordeaux-binary-i386.torrent


The preceding command saves the downloaded files in a directory named bordeaux (the name of the Fedora release) as specified by the .torrent file. Figure 13-2 (next page) shows bittorrent-curses running. Depending on the speed of the Internet connection and the number of seeds, downloading a large torrent can take from hours to days.

Figure 13-2. bittorrent-curses working with the Fedora Core torrent


Caution: Make sure you have enough room to download the torrent

Some torrents are huge. Fedora Core comprises files that total more than 3 gigabytes. Make sure the partition you are working in has enough room to hold the files you are downloading.


For a list of options, give the command bittorrent-curses help. One of the most useful options is max_upload_rate, which limits how much bandwidth other BitTorrent users can use while downloading the torrent from you. The default is 20; specify 0 when you do not want to limit the upload bandwidth. The following command prevents BitTorrent from using more than 10 kilobytes per second of upstream bandwidth:

$ bittorrent-curses --max_upload_rate 10 bordeaux-binary-i386.torrent


BitTorrent usually allows higher download rates for clients that upload more data, so it is to your advantage to increase this value if you have spare bandwidth. You need to leave enough free upstream bandwidth for the acknowledgment packets from your download to get through or else the download will be very slow. By default, the client uploads to a maximum of seven other clients at once. You can change this number by using the max_uploads argument, followed by the number of concurrent uploads you wish to permit. The default value, which can be specified by 1, is a reasonable number based on the max_upload_rate. If you are downloading over a modem, try setting max_upload_rate to 3 and max_uploads to 2.

The name of the file or directory that BitTorrent saves a file or files in is specified as part of the .torrent file. You can specify a different file or directory name by using the save_as option. The torrentinfo-console utility displays the name of the file or directory that the torrent will be saved in, the sizes of the files, and other information about the torrent:

$  torrentinfo-console bordeaux-binary-i386.torrent torrentinfo-console 4.4.0 - decode BitTorrent metainfo files metainfo file...... : bordeaux-binary-i386.torrent info hash...........: 7be29789a9e257a4edaebec3417bf98e3ed459a3 directory name......: bordeaux-binary-i386 files...............:    FC-5-i386-disc1.iso (687235072)    FC-5-i386-disc2.iso (700618752)    FC-5-i386-disc3.iso (721016832)    FC-5-i386-disc4.iso (720910336)    FC-5-i386-disc5.iso (387753984)    FC-5-i386-rescuecd.iso (79122432)    SHA1SUM (671) archive size........: 3296658079 (12575 * 262144 + 197279) tracker announce url: http://torrent.linux.duke.edu:6969/announce comment.............:


You can abort the download by pressing CONTROL-C. The download will automatically resume from where it left off when you download the same torrent to the same location again.




A Practical Guide to Red Hat Linux
A Practical Guide to Red HatВ® LinuxВ®: Fedoraв„ў Core and Red Hat Enterprise Linux (3rd Edition)
ISBN: 0132280272
EAN: 2147483647
Year: 2006
Pages: 383

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net