Downloading (legal) content using torrents is very convenient, but if you plan to “seed” back the stuff, then you’ll need to keep your computer running 24/7 which won’t be good for your electricity bills. For this reason it’s a nice idea to use a Raspberry Pi as a “torrent server” a.k.a “seedbox” which will run day and night, as it’s power consumption is tiny compared to a laptop, let alone a desktop PC.
We’ll be using Transmission as a torrent client, which can be installed as a “daemon” running in the background all the time on the Raspberry Pi.
First, set up your Raspberry Pi for use. If you’re unsure how to do that, please see my post here.
Then, you’ll need to write and set up Raspbian Lite operating system on the Raspberry Pi, as we’ll be using the Pi in a “headless” server mode. On how to set that up, check my tutorial here.
Since this will be a server it would be a good idea to assign a static IP address to it, so we always access it on the same IP. On how to do this on Raspbian Lite (version Jessie), you can read this ModMyPi tutorial.
When the above are ready, please SSH to your Raspberry Pi and install Transmission torrent client like this:
sudo apt-get update sudo apt-get upgrade sudo apt-cache show transmission-daemon sudo apt-cache policy transmission-daemon sudo apt-get install transmission-daemon dpkg -l | grep transmission sudo usermod -a -G debian-transmission pi
Before we make all the changes we want, we should make sure the transmission-daemon isn’t running. Let’s check the status first. If it’s active and running, let’s stop it. Then check the status again to see if it’s really stopped.
sudo service transmission-daemon status sudo service transmission-daemon stop sudo service transmission-daemon status
Then we’ll have to edit the transmission-daemon to run in the name of the Raspbian’s user “pi”, instead of the user “debian-transmission” which is set by default in transmission-daemon.
sudo nano /etc/init.d/transmission-daemon
change this line:
so it looks like this:
Now we set the permissions on the folders transmission keeps the config files. If it can’t read and write the configs, it won’t run. As we’ll be running transmission-daemon as the “pi” user, the commands are the following:
sudo chown pi:debian-transmission -R /etc/transmission-daemon/ sudo chown pi -R /var/lib/transmission-daemon/
We need to make sure transmission-daemon will start by itself after every reboot.
sudo update-rc.d transmission-daemon defaults
Now comes the config file.
You can edit it in it’s original location (but it has a long path to enter and remember)
So you can also use a this symlink which points to it. It doesn’t matter which you choose, you’ll be editing the same file anyway.
If you’re looking for some inspiration, you can use my settings.json file which I keep here. Just make sure you change the username, password and other bits and pieces which are relevant to you.
Now let’s see if it starts :)
service transmission-daemon start
You don’t need to use sudo anymore, because we should be able to start it as the user “pi”.
If you use an NFS server to share the files downloaded with Transmission, restart all related services:
sudo exportfs -ra sudo service nfs-kernel-server restart service transmission-daemon restart
To test if the transmission-daemon starts OK after a reboot, we should test it.
After the Pi reboots, we can log back to it via SSH.
Transmission also has a web-based graphical user interface (GUI) which we can use to manage our torrents, it’s very handy. Open a browser on our laptop, and try if we can reach the web interface. Of course you’ll need to insert the static IP of your own Raspberry Pi there.
This should bring up a login box. The username and password are stored in Transmission’s settings.json we have set earlier.