Here is a really easy process to turn your Raspberry Pi into a high performance Bit-torrent server that can be used to download or upload Bit-torrent. Using Raspberry Pi as a BitTorrent can be good for users who are using more than one OS or hardware or prefer to download their stuff in the background while doing any other work. It can also be useful if you want to access all your BitTorrent in one place without changing hardware.

We would be using Transmission daemon as our BitTorrent client as it is very lightweight and comes with a really nice Web UI. We will be reverse proxy Transmission daemon using Nginx as it lets give performance benefits. This tutorial is for Debian based Linux distributions for Raspberry Pi like Raspbian or if you prefer minimal build I would recommend the Raspbian-UA-Netinst. Lets get started.

Installing.

If you are root user you don’t require to have sudo before every command.


Updating local package database.

sudo apt-get update  


Installing Transmission daemon.

sudo apt-get install transmission-daemon 

 
Installing Nginx.

sudo apt-get install nginx-full 


Stopping Transmission Daemon to write changes in settings.json file.

service transmission-daemon stop  


Editing settings.json that is located in /etc/transmission-daemon/settings.json.

nano /etc/transmission-daemon/settings.json  


You configuration file should look something like this.

{  
    "alt-speed-down": 15,
    "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": 15,
    "bind-address-ipv4": "0.0.0.0",
    "bind-address-ipv6": "::",
    "blocklist-enabled": true,
    "blocklist-url": "http://blacklistedsite.com",
    "cache-size-mb": 4,
    "dht-enabled": true,
    "download-dir": "/home/pi/Downloads",
    "download-limit": 100,
    "download-limit-enabled": 0,
    "download-queue-enabled": true,
    "download-queue-size": 5,
    "encryption": 1,
    "idle-seeding-limit": 30,
    "idle-seeding-limit-enabled": false,
    "incomplete-dir": "/media/NASDRIVE/Torrent_inprogress",
    "incomplete-dir-enabled": true,
    "lpd-enabled": false,
    "max-peers-global": 200,
    "message-level": 2,
    "peer-congestion-algorithm": "",
    "peer-limit-global": 240,
    "peer-limit-per-torrent": 60,
    "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": true,
    "rpc-bind-address": "0.0.0.0",
    "rpc-enabled": true,
    "rpc-password": "{46949fbf39bfeec6dc9d4bff9f40c3f52219a4260yk9yGNo",
    "rpc-port": 9091,
    "rpc-url": "/transmission/",
    "rpc-username": "transmission",
    "rpc-whitelist": "127.0.0.1",
    "rpc-whitelist-enabled": false,
    "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": true,
    "umask": 7,
    "upload-limit": 100,
    "upload-limit-enabled": 0,
    "upload-slots-per-torrent": 14,
    "utp-enabled": true
}

You can change the configuration as you prefer to suite your needs. It is a really simple JSON document that can be edited really easily and can do many performance differences. I would recommend that you should change the rpc-username, rpc-password string and disable rpc-whitelist-enabled If you wan’t all ip address to access the Transmission Daemon. The most important thing to change is rpc-bind-address. change it from

"rpc-bind-address": "0.0.0.0",  


to

"rpc-bind-address": "127.0.0.1",

  
This will let Transmission daemon run on 127.0.0.1 instead of make it run on the external ip address and makes slow as it has needs to first known the IP and then run it. Next is reverse proxy it using NGINX. For that we can edit the default located in /etc/nginx/site-enabled/default. Replace the file content with this.

server {  
        listen 80; 
        location / {
        proxy_pass       http://127.0.0.1:9091;
        proxy_set_header Host      $host;
        proxy_set_header X-Real-IP $remote_addr;
        }
}

 
Now start Nginx.

service nginx start

  
Lets start transmission daemon.

service transmission-daemon start

  
Now you have Transmission daemon running on port 80 of your Raspberry Pi address. Visit your Raspberry Pi IP address and you should have the Transmission Web UI waiting for you to add a new BitTorrent. The amount of BitTorrent you download also depends on the SD card size. It is recommended that you use an external HDD to serve storage purpose.

Thanks for reading. If you have any question feel free to leave a comment below.