How to run Transmission torrent server on Linux server

This post is a quick tutorial on how to install and configure Transmission torrent client on Linux (Debian, Ubuntu) server in headless mode.

Create directory to store downloads:

mkdir ~/Downloads

Install transmission (run as root or with sudo):

apt-get install transmission-daemon

Add your user to debian-transmission group (run as root or with sudo):

usermod -a -G debian-transmission user

Setup correct permissions to Downloads folder, for starters I suggest setting 777:

chmod 777 ~/Downloads

As your user start transmission - this will generate basic configuration file (run this as your user):

transmission-daemon

Right after it starts, you can stop it (also run this as your user):

/etc/init.d/transmission-daemon stop

Substitute this file: ~/.config/transmission-daemon/settings.json with following content:

{   
    "alt-speed-down": 50,
    "alt-speed-enabled": false,
    "alt-speed-time-begin": 540,
    "alt-speed-time-day": 127,
    "alt-speed-time-enabled": false,
    "alt-speed-time-end": 1020,
    "alt-speed-up": 50,
    "bind-address-ipv4": "0.0.0.0",
    "bind-address-ipv6": "::",
    "blocklist-enabled": false,
    "blocklist-url": "http://www.example.com/blocklist",
    "cache-size-mb": 4,
    "dht-enabled": true,
    "download-dir": "/home/user/Downloads",
    "download-queue-enabled": true,
    "download-queue-size": 5,
    "encryption": 0,
    "idle-seeding-limit": 30,
    "idle-seeding-limit-enabled": false,
    "incomplete-dir": "/home/user/Downloads",
    "incomplete-dir-enabled": false,
    "lpd-enabled": true,
    "message-level": 2,
    "peer-congestion-algorithm": "",
    "peer-id-ttl-hours": 6,
    "peer-limit-global": 200,
    "peer-limit-per-torrent": 200,
    "peer-port": 51413,
    "peer-port-random-high": 65535,
    "peer-port-random-low": 49152,
    "peer-port-random-on-start": false,
    "peer-socket-tos": "default",
    "pex-enabled": true,
    "port-forwarding-enabled": true,
    "preallocation": 1,
    "prefetch-enabled": 1,
    "queue-stalled-enabled": true,
    "queue-stalled-minutes": 30,
    "ratio-limit": 2,
    "ratio-limit-enabled": false,
    "rename-partial-files": true,
    "rpc-authentication-required": false,
    "rpc-bind-address": "0.0.0.0",
    "rpc-enabled": true,
    "rpc-password": "{4b0b9b0633878s8d9sd89h37892fdxG}",
    "rpc-port": 9091,
    "rpc-url": "/transmission/",
    "rpc-username": "",
    "rpc-whitelist": "127.0.0.1",
    "rpc-whitelist-enabled": true,
    "scrape-paused-torrents-enabled": true,
    "script-torrent-done-enabled": false,
    "script-torrent-done-filename": "",
    "seed-queue-enabled": false,
    "seed-queue-size": 10,
    "speed-limit-down": 100,
    "speed-limit-down-enabled": false,
    "speed-limit-up": 100,
    "speed-limit-up-enabled": false,
    "start-added-torrents": true,
    "trash-original-torrent-files": false,
    "umask": 2,
    "upload-slots-per-torrent": 14,
    "utp-enabled": true
}

You should substitue following properties to match your own setup:

"incomplete-dir": "/home/user/Downloads",
"download-dir": "/home/user/Downloads",
"rpc-whitelist": "127.0.0.1",
"rpc-password": "{4b0b9b0633878s8d9sd89h37892fdxG}",

Both incomplete-dir and download-dir should point to the newly created directory. rpc-password should be set to long random value. rpc-whitelist is a list of hosts that are allowed to view administrator interface over the browser, it should include the IP address of your local environment. Alternatively if you don’t have a static IP address, then you should set rpc-username which will be used to authorize user on the WWW interface.

Start transmission-daemon (as your user), this time new configuration will be used.

transmission-daemon

Configure firewall, I have added following rules:

iptables -A INPUT -p tcp --dport 51413 -j ACCEPT
iptables -A INPUT -p udp --dport 51413 -j ACCEPT
iptables -A INPUT -i eth0 --source MY_LOCAL_IP -j ACCEPT

Visit web UI where you can add torrents for download: http://yourserver.com:9091/ - transmission should be ready to serve there.