Search:  
Gentoo Wiki

HOWTO_Setup_A_Bittorrent_Tracker

This article is part of the HOWTO series.
Installation Kernel & Hardware Networks Portage Software System X Server Gaming Non-x86 Emulators Misc

This guide assumes you have a working installation of Apache. Make sure you have that setup first.

Apache

Make apache listen on the port you define for bit torrent.

File: /etc/apache2/httpd.conf
Listen 80
Listen 11234

Don't forget to restart Apache after making this change /etc/init.d/apache2 restart


Edit by eXistenZ:

WARNING! Above information is wrong. Make sure apache is NOT running on the port your tracker should be running on. Just leave Apache on port 80. Apache is in fact not even necessary at all! The tracker provides it's own talk-to-me-in-html interface :)

I know this because I just set up my own tracker.

The Mainline Tracker

# emerge -av bittorrent

Remember to check the use flags of what you compile. The use flag gtk will pull in xorg and other gtk dependencies. If you don't need a GUI for this, don't enable that flag.

Copy and paste the following into their respective files:

File: /etc/conf.d/bttrack
# /etc/conf.d/bttrack: config file for /etc/init.d/bttrack

# Change this to this to the port you would like to connect to for the tracker.
# It is accessible at http://[HOSTNAME]:PORT/ from any web browser.
# Some ISPs block bit torrent ports.  Sometimes it's best to avoid ports in the 6*** and 80** range.
PORT=11234

# Where to store recent downloader info
DFILE=/usr/share/bittorrent/tracker.dfile

# Where torrents are stored 
ALLOWED_DIR=/var/www/torrents/

# Path to favicon.ico which web browsers can use
# The example uses the same one my httpd uses.
FAVICON=/var/www/favicon.ico

# Connection logs are sent to stdout by default, so they should be sent to a
# file when using this script.
LOGFILE=/var/log/bttrack.log
File: /etc/init.d/bttrack
#!/sbin/runscript

depend() {
        need net
}
start() {
        ebegin "Starting bttrack"
        start-stop-daemon --start --quiet --background --make-pidfile \
                --pidfile /var/run/bttrack.pid \
                --exec /usr/bin/bittorrent-tracker -- --port ${PORT} \
                --dfile ${DFILE} --favicon ${FAVICON} --logfile ${LOGFILE}
        eend $?
}

stop() {
        ebegin "Stopping bttrack"
        start-stop-daemon --stop --quiet --pidfile /var/run/bttrack.pid
        eend $?
}

Make sure to run

# chmod +x /etc/init.d/bttrack

to make the script executable.

Now type

# /etc/init.d/bttrack start

to start the tracker. I also recommend to add it to the default runlevel so that it starts every time the system starts up.

# rc-update add bttrack default

Creating a Torrent

There are many different methods of creating a torrent and many clients have the ability to do so. Createtorrent is a nice command line package which helps create torrents and is in the portage tree. Buildtorrent is even better but is not in the portage tree yet.

Retrieved from "http://www.gentoo-wiki.info/HOWTO_Setup_A_Bittorrent_Tracker"

Last modified: Mon, 09 Jun 2008 11:07:00 +0000 Hits: 30,439