Raspberry Pi Home Server v2: Transmission

Note: This post is part of a series. Each post builds on the previous ones. If you are just trying to add one thing to an existing system that was not built following this series, then I cannot promise that these instructions will work for you, although they probably will. If you’ve started from something other than a non-NOOBS Raspbian image, then you’ll probably need to adjust for that.

Please refer to the series Introduction for a list of all the different posts in the series.

Self-Promotion: I have recorded this series as a screencast for Pluralsight:
(http://www.pluralsight.com/courses/raspberry-pi-home-server)
If you have a Pluralsight subscription, please consider watching it. Reading the instructions is one thing, but watching it done demystifies the whole process.

Thank you!


Sometimes you want to download something large. “Transmission” and “Deluge” are cross-platform BitTorrent servers that will run quite happily on a Raspberry Pi. They can be used to host, or “seed” a torrent for other users to download, or to download other people’s torrents for you, freeing up your main computer to do other jobs or to sleep.

What’s a BitTorrent?

Let’s say I wanted to download the current Raspbian image file. I could get it straight from the Raspberry Pi website, but that means that I’m competing for bandwidth with all of the other people trying to get that same file, and that bandwidth is costing the Raspberry Pi Foundation money, money they could be using to build more cool toys.

Torrents work by asking all of the computers downloading a particular file to talk to each other and trade the bits they already have amongst each other instead of everybody downloading the same bits of the same file from the Raspberry Pi Foundation’s server. Through the magic of BitTorrent, one computer could says to the others “Hey, I already have the first half of the file, does anyone have the second?”, and another computer might answer “Well, I don’t have the whole second half, but I have most of it. I’ll give you what I have if you give me the first third, ‘cause I’m totally missing that”.

At the center of it all is one computer that started the whole thing off by hosting the complete file first, and staying on to serve as “matchmaker” when new computers get added to the mix. In the case of the NOOBS software, that’s the Raspberry Pi Foundation’s server again. The foundation’s server started with a complete copy of the file, from which it created a .torrent file. The .torrent file describes the file you’re trying to get, providing information like how big it is, how many chunks it’s been broken into, and providing a checksum hash of the complete file so that you can be sure you got all the pieces right, and to stop jerks from ruining it for everyone by hosting files with the wrong bits in them.

You start a download of the large file you want by first downloading the much smaller .torrent file. You feed this file to a BitTorrent client like Transmission or Deluge, which contacts the original server to see what peers are online sharing the load. Then, the client starts getting bits from all the different peers in the network, and only contacting the original server for those parts that no-one else has yet.

When the download of the large file is complete, the client stays online as part of the network, and just keeps on sharing (or “seeding”) the bits of the large file to anyone else who might need them.

Torrents have a kind of a bad reputation since they have become a kind of ersatz peer-to-peer file sharing mechanism for trading things like Hollywood movies, but they can be terribly useful for anyone that wants to mitigate the bandwidth costs of distributing large files on the internet.

Transmission vs. Deluge

The first thing you’ll want to decide is whether you want to go with Transmission or Deluge. They both do the same job, but Transmission’s interface is much simpler. Transmission got a bad reputation of its own when its installer was found to be spreading malware twice in 2016. This apparently wasn’t a purposeful attack by the Transmission team, and they moved quickly to correct the situation, but some people are uncomfortable with Transmission even now.

There is an excellent guide to installing Deluge at HowToGeek, but for now, I’m sticking with Transmission for its pure ease of installation on the Pi. I may do a Deluge write-up later on, in which case I’ll update this post to refer to it, but for now I’m just going to show you how to install and configure Transmission.

I don’t recommend installing both at the same time. While their respective web front-ends use different ports, their background daemons will want to use the same port, and will interfere with each other. I’m sure you can configure your way around this, but you only need one anyway. Pick your favorite and install it.

Note: I have found Transmission to be one of the most destabilizing influences on the Pi. I have not yet given Deluge a full test, but with Transmission running, my Pi becomes very sluggish and unresponsive when downloading very large torrents. On average, this may not affect you, but I suspect it has everything to do with the size of the thing you’re downloading. I’m talking about multi-hundred gigabyte downloads here, much larger than your average download. I’m not sure Deluge would fare much better, but I intend to find out at some point. If you regularly download HUGE items, then you may want to dedicate a second Pi with its own hard drive to this task rather than your main home server.

Installing Transmission

To install the Transmission daemon (that’s a service to you Windows folks), type the following at the command prompt.

sudo apt-get install transmission-daemon

It’s a pretty simple installation, but will require some configuration before it’s ready to use.

Configuring Transmission

Before editing the configuration file, make sure the transmission daemon is stopped.

sudo service transmission-daemon stop

Transmission keeps its settings in a JSON-formatted text file. Use Nano to edit it.

sudo nano /etc/transmission-daemon/settings.json

Change the following settings, modifying the download path to match whatever you called your external drive, and changing the user name and password. I’m going to make mine match the pi user so it’s easier to remember. Don’t worry about the password being in plain text. After we restart the Transmission daemon, it will encrypt the setting so no-one will be able to read it.

"download-dir": "/mnt/data/public/downloads",
"rpc-enabled": true
"rpc-whitelist-enabled": false
"rpc-username": "pi"
"rpc-password": "raspberry"

Note: You could limit the computers that are allowed to see Transmission’s web interface by leaving “rpc-whitelist-enabled” set to true, and then entering a comma-delimited list of IP addresses. You could also set the whitelist to “192.168.*.*” to allow any computer on the local network to see the interface. Since I’m not exposing Transmission’s ports through my firewall, turning the whitelist off achieves pretty much the same effect though.

Exit Nano, saving your changes (ctrl-x,y,enter).

Once again, a program is managing its own list of passwords. You get that a lot in the Linux world. I’ve kept the default user name of “transmission” here, and used the default password for “pi”. Pick whatever you want. Finally, restart the transmission daemon (service).

sudo service transmission-daemon start

Transmission provides its own web interface, so there is nothing to add to Webmin. Open a browser and navigate to the Raspberry Pi, port 9091, and after logging in with the credentials you created in the config file, you should see the Transmission interface.

Time to give back

At this point, I’d like to suggest that you seed the archives for NOOBS and other Raspberry Pi images. Click on the open folder icon in the top left, enter the url of one of the torrent files, and click “Upload”.

The latest version of the NOOBS and Raspbian torrents are always available from the following addresses:

A row for each .torrent file you upload will be added to the list, and the torrent will begin downloading. Click on the new row to select it, and click the blue “i” icon in the upper right to get more detailed information about how the download is progressing. When all the bits have finished downloading, and a torrent goes into “seeding” mode, its progress bar will turn green like this:

image

You might consider seeding all of the Raspberry Pi images if you can spare the space. Remember to pay attention to how much CPU is being used, and don’t overtax your Pi. If you seed too many torrents, there may not be much CPU left for other tasks.

There are Transmission “remote control” applications available for many platforms that will give you greater control over the download process, but they are beyond the scope of this post. You can start by looking at the Add-Ons section of the Transmission website (https://www.transmissionbt.com/resources)

Wrapping up

Now that Transmission is installed and running, you should shut down the Pi and take a backup of the SD card or OS partition as usual.

This entry was posted in Computers and Internet, Home Server, Raspberry Pi and tagged , , , . Bookmark the permalink.

One Response to Raspberry Pi Home Server v2: Transmission

  1. Thank you for this review, it is very useful information.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s