Host a bittorrent tracker

Hello everyone,

I recently decided to host my own bittorrent tracker so I can share files with
my mum without using anyone else’s service.

I successfully installed opentracker and I wanted to share the info in case some
of you wanted to do the same. After a ssh on the server, here is what I did :

Install opentracker :

cd /home/admin
git clone git://erdgeist.org/opentracker
cd opentracker
sudo apt install libowfat-dev zlib1g-dev # necessary to compile opentracker
make

Open the port in the firewall :

sudo yunohost firewall allow Both 6969

In my case, my server is behind a router, I also forwarded port 6969 from WAN to
the server.

As of now, it is possible to test if it works properly :

On the server, run opentracker :
/home/admin/opentracker/opentracker

On a computer, create a torrent file and set its tracker to
“udp://yourserver.nohost.me:6969” (replace “yourserver.nohost.me” with your
domain).
Share it with a friend, transfer will work as expected.

Now, if you stop opentracker on the server, you won’t be available to share your
files anymore. So, use systemd to run opentracker at startup by writing a file
(make sure to add an & at the end of the ExecStart command, otherwise the server
will never complete the boot sequence) :

sudo vim /etc/systemd/system/opentracker.service

[Unit]
Description=opentracker
After=network.target

[Service]
WorkingDirectory=/home/admin/opentracker
User=admin
Group=users
Type=simple
UMask=000
ExecStart=/home/admin/opentracker/opentracker &
RestartSec=15
Restart=always

[Install]
WantedBy=multi-user.target

Then enable the service and start it:

sudo systemctl enable opentracker.service
sudo systemctl start  opentracker.service

That’s it. Your bittorrent tracker is now functioning.
Hope this helps.

alb

Ps: feel free to tell me if I missed anything.

6 Likes

Hi,

Looking at the output of ldd.

ldd opentracker
linux-vdso.so.1 (0x00007fff19988000)
libowfat.so.0 => /usr/lib/libowfat.so.0 (0x00007f164fb99000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f164f97b000)
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f164f75d000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f164f3a3000)
/lib64/ld-linux-x86-64.so.2 (0x00007f164ffe9000)

opentracker also depends on, libz aka zlib1g as a debian package.

Kiss,

labo

2 Likes

HI alb1,

I am working on a project on a network that blocks the use of udp. so does opentracker also supports http: ?

Will this work : http://my-server-ip:6969

I am using virtualbox to generate that environment 1) One FreeBSD image with opentracker on one machine and 2) One ubuntu image with bittorrent client to create and include the tracker. 3) Another ubuntu image with same client to download the file.

All three machines are on bridged mode with my home router (NAT Network is not working idk why?).

Hello Vaibhavsaharan,

To use opentracker with TCP, just open port 6969 for TCP instead of Both:
sudo yunohost firewall allow TCP 6969

And when you create your torrent file, use http instead of udp with the announce keyword:
http://yourserver.nohost.me:6969/announce
(replace “yourserver.nohost.me” with your domain)

That should do the trick.

Thanks! Worked like a charm <3