layout: post title: "Download torrents on your server" date: 2013-12-25 22:34 comments: true categories: [server] cover: /images/cover/avatar.png keywords: transmission, torrent, server, remote, rsync, firewall
Recently I've needed to download some stuff from torrentz. I have quite unstable and slow internet connection at home, so I've decided to download the stuff to my server and later transfer it to my laptop via rsync (with transfer resume enabled and high compression ratio).
There are many torrent clients suitable for headless Linux server (so they don't need X.Org server and allow remote access). I've picked out Transmission. It looks easy to configure & use, supports magnet links, is lightweight, has web interface and is actively developed.
If your Linux distribution provides split Transmission package, you need just transmission-cli or transmission-daemon (simply, ignore GTK or Qt packages).
After installation edit Transmission daemon configuration file (may be located
here /var/lib/transmission/.config/transmission-daemon/settings.json
or
here /etc/init.d/transmission-daemon/settings.json
).
Interesting options you'll probably need to edit are these:
If you're a bitch and want to disable seeding right after torrent download is completed,
set ratio-limit
to 0
and ratio-limit-enabled
to true
.
You don't need any HTTP server like Apache or Nginx, just go to http://your_domain:9091. Enter login username (by default empty) and password. That's all.
{% img fancybox /images/transmission.png Transmission web client %}
Find peer-port
option in transmission config. Open this port in /etc/iptables/iptables.rules
:
-A INPUT -p tcp -m tcp --dport 51413 -j ACCEPT
-A OUTPUT -p tcp -m tcp --sport 51413 -j ACCEPT
-A OUTPUT -p udp -m udp --dport 80:60000 -j ACCEPT
Port 51413 has to be opened otherwise Transmission cannot download and upload data. Also I've opened a range of UDP ports because of magnet links.
Transmission daemon can run any script after downloads are completed.
First I've set script-torrent-done-enabled
to true
and inserted
full path to the script into script-torrent-done-filename
option.
Here's my script:
{% codeblock lang:bash %}
echo "'$TRTORRENTNAME' is finished!" | gnu-mail -a "From: cinan.remote@gmail.com" -s "Torrent download finished" cinan6@gmail.com {% endcodeblock %}