How to Create Your Own Torrent Tracker with RivetTracker

There are some things that are less about usefulness, and more about the cool factor. One such thing is setting up your own torrent tracker. There are plenty of legitimate use cases, but for most people, a personal tracker would be overkill. If, however, you need to distribute large files without wasting bandwidth, or just want to know how all this works, you can get one started fairly easily with RivetTracker. All you need is the right software and a basic understanding of Apache to get things moving.

A Little About RivetTracker

RivetTracker is a Bittorrent tracker written in PHP. It’s based on PHPBTTracker and includes detailed statistics, user management, browser-based configuration “wizard”, and plenty more. Since it’s PHP, RivetTracker isn’t necessarily dependent on any specific platform. This is the full list of requirements as stated by the RivetTracker website:

  • A webserver, Apache is a great one.
  • A recent version of PHP.
  • The MySQL Database.

In short, it needs a LAMP server to operate (WAMP or MAMP server will also work). In this guide, we will be using Ubuntu 9.10, Apache 2.2.12, and PHP 5.2.10 as a reference.

Prerequisites

If you intend to run this tracker on a professionally hosted server, it should have all the necessary software installed.

If you intend to run this on your own server, you have to follow the article here to install a LAMP server in your system first before proceed.

During the installation of LAMP server, it will prompt you to create a root user, take note of the name and password you choose as we’ll need it later.

Note: Make sure you have installed the LAMP server successfully and verified that it is working before you proceed.

Installing RivetTracker

You can download the tarball from the RivetCode website and save it in your home directory. Extract the tarball (simply right-click on the tarball and select “Extract here“). You should now have a folder full of RivetTracker’s files, mostly in PHP form.

Rename the folder to “tracker” (without the quote)

Next, we are going to copy the tracker folder to your Apache web server. In your terminal:

sudo cp -R ~/tracker /var/www/

Setting Up RivetTracker

To begin the setup, open a web browser and point the URL to http://127.0.0.1/tracker/install.php.

We’ll be proceeding with the second option, letting RivetTracker create the needed database automatically.

rivettracker-install

In the field where it asks you for your admin username and password, enter the one that you have created earlier while setting up the LAMP server.

rivettracker-dblogin

If you’re running RivetTracker on a commercial server, you may be able to use your usual login for that host. If not, you will need to contact your web host regarding MySQL access before you can proceed.

Main Configuration

If all went well in the last step (it should have clearly indicated the problem if not), you’ll get a message indicating the database was created successfully, and you’ll see the main configuration page.

rivettracker-config

Many can be left at the defaults, but there are a few that you’ll want to make sure to check:

  • Make tracker hidden: Will force a login to view torrent list
  • Persistent MySQL connections: Probably a good idea if you’re running this on your own server
  • Upload and Admin user accounts
  • Title on index.php statistics page: This will be the main header text on the front page
  • Enable RSS feed: RivetTracker can send out feeds about new torrents
  • Main website url
  • HTTP seeding rate: In short, the amount of bandwidth to sacrifice to HTTP seeding
  • HTTP seeding count: How many files to seed at a time
  • Timezone

When ready, save the configuration. If the installer throws an error saying that it can’t save the config file, don’t panic. Just save the config.php file with the handy button, and manually copy it to the /var/www/tracker folder (you will need to have root permission).

Delete the install.php file

Now that you are done with the installation, you will need to remove the installer file to prevent someone from accessing it and use it to reconfigure your tracker.

sudo rm /var/www/tracker/install.php

Setting Permissions

To add new torrents and RSS feed, we need to change the permissions on the torrents and RSS directory:

sudo chmod 777 /var/www/tracker/torrents
sudo chmod 777 /var/www/tracker/rss

Note: Setting the permissions to 777 is a TEMPORARY solution. Securely setting permissions for writeable data on web servers is beyond the scope of this guide, and it is highly recommended that you look into that before deploying your tracker live.

You are good to go

Until this stage, if everything go smoothly, you should be able to access your tracker site now. Point your browser to your tracker’s address (http://127.0.0.1/tracker/)

rivettracker-main

Now’s a great time to test out those users you set up. The first has the capacity to upload but not delete, so let’s upload. Click Add Torrent to Tracker Database and you’ll be asked for a login. Enter the credentials of the uploading user and you’ll be knocked back to the main page where you can go back and get upload screen.

Note: Your tracker URL when creating torrents will be your tracker’s full address, ending with announce.php, such as http://127.0.0.1/tracker/announce.php

Once you’ve got the torrent file entered, the other options can normally be left at defaults. As long as you’ve got the permissions set on the torrents directory in your site’s root, and the torrent file has your tracker URL, you should be all set.

rivettracker-mainwithtorrent

If you need to remove a torrent, you can do so by logging in as the administrative user and clicking Admin on the main page. You’ll find many other useful things there as well, such as additional statistics and configuration settings.

Now, you can go brag to your friends that yeah, you run your own torrent tracker, but really it’s no big deal.