Saturday, April 1, 2017

Raspberry Pi Torrentbox

Continuing with the Raspberry Pi posts this time I'm writing about how you can transform your Raspberry Pi into an always On torrent box.

Although this is April 1st but don't worry this method works. So why should anyone use Raspberry Pi as their torrent box? If you think about it a Raspberry Pi consumes very little power so it is very easy to keep it running for long time instead of keeping a full PC running. You can just start a download and go about your business and at the end of the day the file will be there for you to use. There is even no need for getting it to your computer, you can watch it on the Pi itself or turn your Pi into a Network attached storage so you can watch it directly from the Pi.


So what do we need? 

1. Raspberry Pi, whichever model you have. I find Raspberry Pi 2 to be the most suitable candidate.
2. Power Supply and micro SD for Pi.
3. Extra storage solution, whether an USB based flash drive or a hard drive.
4. Working copy of Raspbian.
5. Internet connection, I will recommend using the Wired one as it is much faster than the Wi-Fi.


Procedure:

1. Like always we will start the process with updating the operating system. The code for that is

sudo apt-get update
sudo apt-get upgrade




2. Now that everything is nice and updated it is time to install a torrent client called Transmission. Personally I have used both Transmission and Deluge and found that Deluge looks much smarter but Transmission is much easier to use. To install it we have to type

sudo apt-get install transmission-daemon


Seems like I already have the newest version.

3. Now to make Transmission work we have to modify couple parameters so what we are going to do is simply stop Transmission so that we can edit the settings.json file.

sudo service transmission-daemon stop



4. Now that the service is stopped we can start editing. To do so we have to type in

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


So the settings.json file is open, we have to edit some items such as

a. 

"rpc-authentication-required": false

This will get rid of authentication when connecting to Transmission via web browser.




b. 

"rpc-whitelist": "127.0.0.1,192.168.0.*"

This will allow us to use the transmission web based interface with all computers on the network(including localhost) with IP 192.168.0.x, where x could be any numerical value. I know that the way my Router's DHCP server is set it will give out IP addresses like this, if your Router gives off different IP like 192.168.1.x then you have to use that value. As with the DHCP we know that after lease time IP addresses are given to other devices if not renewed, so the IP address of Pi can change. If you want to avoid that all you have to do is simply reserve an address for it. I will post in a link how to do that in your Router at the end of the post. 




c. 

"rpc-port": 9091
"rpc-url": "/transmission/"


that's all the edits we need. Save and exit from here.


5. Now let's start the service again by typing.

sudo service transmission-daemon start




6. Time to test. Get to the browser of your computer and type in the IP address and the port, for me I know my Raspberry Pi 2 can always be reached by a certain address that is reserved so for me

192.168.0.100:9091


Seems like it is working.


7. So let's grab a torrent file and upload it or put the URL of that torrent after hitting the "Open Torrent" button at the very left.


So I grabbed the torrent file of Ubuntu OS and let's see if the Pi can download it.



Seems like the Pi is downloading the file just fine. Seems a bit slow but it is downloading it. You can change the default directory or limit speed from the settings menu by clicking on the bottom left corner buttons. So we have a working torrent down loader that can be kept on for long time.


Note:

1. Raspberry Pi might not download torrents that fast as it lacks Gigabit Ethernet so even if you connect it directly to your router via Ethernet port you will get 100Mbps at best, connection-wise, Pi might download it at somewhat lower speed.(If your internet is not that fast, say 4-5Mbps, you should be fine)

2. It also lacks high speed storage support. There are other boards out there with Gigabit Ethernet and SATA port or USB 3.0 port, those should be much suitable for this purpose but as you can see for normal usage this one works fine as well.

3. If after rebooting, the transmission web base interface does not show up just stop and restart the service by typing the following commands in the terminal or via SSH.

sudo service transmission-daemon stop
sudo service transmission-daemon start





Resources: 

1. Read my other posts here.
2. All posts about Pi.
3. How to reserve an address on your Router. 

No comments:

Post a Comment