Here is a straightforward 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 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 recommend the Raspbian-UA-Netinst. Let’s get started.

Installing.

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

Updating local package database.

sudo apt update

Installing Transmission daemon.

sudo apt-get install transmission-daemonCode language: JavaScript (javascript)

Installing Nginx.

sudo apt-get install nginx-fullCode language: JavaScript (javascript)

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

service transmission-daemon stop

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

nano /etc/transmission-daemon/settings.json

Your 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
}
Code language: JSON / JSON with Comments (json)

You can change the configuration as you prefer to suite your needs. It is a simple `JSON` document that can be edited 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

"rpc-bind-address": "0.0.0.0"Code language: CSS (css)

to

"rpc-bind-address": "127.0.0.1"Code language: CSS (css)

This will let Transmission daemon run on 127.0.0.1 instead of making it run on the external ip address and makes slow as it has needs to first know the IP and then run it. Next is reverse proxy it is 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;
	}
}
Code language: Nginx (nginx)
service nginx start 

Let’s 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.

I compiled a list of software and services that I use to improve my workflow, here is the link to the list.

Darryl Dias

I’m Darryl. I’m a 3D Artist, Programmer and Linux enthusiast. On this site I share my insights, tips and tricks, tutorials, methods and best practices.