How to set it up
We here at the LNX-BBC project have already set up and installed a tracker, and all our .torrent files point to it. You can see a brief statistics page by visiting http://www.lnx-bbc.com:3623/. All you need to do to help us mirror is to run a downloader! How you choose to do that depends on your preference.
The one-file downloader
The stock BitTorrent package comes with a few different python scripts for downloading: ptdownloadgui, which uses wxgtk (but requires a ridiculously recent version, so beware); btdownloadcurses, which uses a nice curses readout; and btdownloadheadless, which spits to stdout, but falls silent if started in the background. There are also "launchmany" versions of these programs available, which we will discuss shortly.
The most user-friendly way to use bittorrent is to follow the instructions in the docs for associating the downloaders with the application/x-bittorrent MIME type. This way, you can just select a .torrent file in your Web browser and let the MIME handler take care of the rest. You'll see a torrent window pop up, and start connecting to peers. Couldn't be simpler, right?
You may also wish to run your downloader in a screen session or something, in which case you could run the downloader at the command line:
$ btdownloadcurses.py --url http://www.lnx-bbc.com/images/bbc-2.0.iso.torrent
The launchmany
But if you want to really help out, you'll mirror more than just one file. For this, there is the launchmany program. The launchmany versions of the programs accept as their parameters the path to a directory full of .torrent files. They regularly poll the directory for new or removed .torrents and update their actions appropriately. As you may guess, this makes them useful as daemons.
btlaunchmanycurses.py
For starters, let's look at the curses version, which I typically use when I'm keeping my downloads in a screen session and want to be able to check up on their status.
[zork(~/torrent)] wget http://www.lnx-bbc.com/images/bbc-2.0.iso.torrent [zork(~/torrent)] wget http://www.lnx-bbc.com/images/bbc-2.0-src.iso.torrent [zork(~)] btlaunchmanycurses.py ~/torrent/
Now I end up with a curses readout showing me the download progress, as well as the upload speed and running totals of my bandwidth use. I can throw in .torrent files or take them out of my ~/torrent directory, and torrent downloads will begin and end as needed.
btlaunchmany.py
But for real long-term use, it's best to keep things headless. To this end, we have btlaunchmany.py. This script will fall silent if run in the background, and is ideal for keeping a mirror going long-term.
For one of our Debian GNU/Linux systems, I have an init script that I use. It ensures that bittorrent starts and stops at the appropriate runlevels, and keeps these files available in the client space.
For yet another of our systems, we use a simple crontab entry to make sure that bittorrent is run on startup:
@reboot nohup btlaunchmany.py /var/www/lnx-bbc.com/images/
This method may work best if you lack root access to the machine you wish to use.
After your launchmany is running
You may wish to set up regular cron jobs to wget all files of the mime type application/x-bittorrent, or to grab all files ending in .torrent from http://www.lnx-bbc.com/images/ or http://www.lnx-bbc.com/builds/. Whatever you do, it is helpful to make sure that the .torrent files in your launchmany directory are up-to-date, so that you are serving recent files.
![[LNX-BBC]](logo.png)