Note: This article is part of a series. See the Index for more information.
Self-promotion: I’ve recorded this series as a screencast for Pluralsight:
If you have a Pluralsight subscription, please consider watching it. Thanks!
Updates: I haven’t personally tested Transmission under the Jessie release of Raspbian because I haven’t been terribly happy with its performance and stopped using it, but no-one has reported any issues, so I’m under the impression that it all still works. I will update if anything comes up.
Sometimes you want to download something large. For instance, the Raspbian or NOOBS file that started off this whole series. “Transmission” is a cross-platform BitTorrent server that will run quite happily on a Raspberry Pi.
What’s a BitTorrent?
Let’s say I wanted to download the NOOBS zip 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, 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.
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.
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. Open it in the nano editor with the following command.
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 password:
"download-dir": "/mnt/data/Downloads", "rpc-enabled": true "rpc-whitelist-enabled": false "rpc-username": "transmission" "rpc-password": "raspberry"
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. You should see the Transmission interface, which is pretty basic.
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:
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)
In the next post, we’ll add CrashPlan, so that the Raspberry Pi can back up your other computers.
Pingback: Raspberry Pi Home Server: Index | MelGrubb.ToBlog()
Pingback: Raspberry Pi Home Server: Part 8, MiniDLNA Media Server | MelGrubb.ToBlog()
I have gotto congratulate you on a most excellent install and setup, I have tried numerous setups out there on the web and all have failed miserably due to instructions.
This far I have installed and run everything on this tutorial albeit the webmin minidlna plugin, for some reason it kept telling me it was the wrong format, ney mind…….
And instead of booting from ext hdd I booted from the 16gig ssd card, Ill try the exthdd boot later on the new pi thats coming…..
Happy teddy hee man.
Even the torrent program worked first time…..been trying for 1 year to get transmission working, allthe othersites make Iit look so complicated and it never ever worked from install…8-)
Keep up the great work.
I shall carry on with the install as from transmission now…..
Just a word of waring though that you have already mentioned in the setup for minidnla…
LET IT POPULATE and cache people ! You where warned in the instructions 😎 ..it takes its time (2 days for me) when I restarted the mini dnla I kept on ..and on and on restarting the ap seeing nothing in the file, went shopping and then on to the pub came back only to find it was working….
Thanks a lot Mel, whole course is really awesome.
Thanks a lot Mel, whole course is really awesome.
Notice that I have a Jessie release of Raspbian on my Raspberry Pi 2 and Transmission works fine.
Side note: After a reboot transmission seems not to start or to not start properly!
I had to stop it and restart it manually
I use the Jessie release of Raspbian on my Raspberry Pi 3 Model B. I compile from the Transmission source code (e.g. v2.92). I also compile the latest OpenSSL, and OpenVPN source code to keep current with security. I have enabled the Low-priority TCP (TCP-LP) congestion algorithm in the Kernel, which is then enabled in the Transmission settings.json file. The setup is rock solid whatever I throw at the Raspberry PI.