Turn your Raspberry Pi into a fully working torrent box

In this post I’ll show you how to configure a Raspberry Pi to work as a torrent-box that can be even remote controlled: your Raspberry will be able to download torrents all day long if needed!

What I used

  • 320GB USB external hard drive self-powered (labeled “HD320G”), NTFS formatted from Windows. This HDD has a folder named “Transmission” in which we will store completed downloads, and inside there is also a folder called “_part” in which we will store incomplete downloads;
  • Raspberry Pi 2 with a clean official Raspbian release installed

First setup

Let’s set up our Raspbian environment and prepare everything for Transmission!

  • Login. We use “pi” as username and “raspberry” as password;
  • Start the UI. By typing startx after login;
  • Configure useful settings. Let’s type raspi-config in the terminal and set the boot to desktop (Enable boot to Desktop/Scratch -> Desktop login as user ‘pi’ at the graphical interface), in the Overclock section choos Pi2 or Turbo (to make the torrent client “smoother”), in the Advanced Options enable SSH (a very useful setting that will allow you to control the Raspberry Pi with a terminal of a another local or remote pc);

    raspi-config script allows you to set all your Raspberry's parameters easily

    raspi-config script allows you to set all your Raspberry’s parameters easily

  • External HDD power. If it’s the first time that you play with Raspberry you should know that power is a precious resource, it has only 3A with the adapter! So if your HDD has not an external power source you will problaby face to different freezes or crashes on your RPi: my advice is to use an external powered HDD or a Y cable maybe attached to your router USB port (as I currently do). But you can also try to force your micro-pc to deliver more energy than usual to usb ports: on your Raspberry desktop open the Terminal and let’s modify /boot/config.txt by typing:

    A text editor will show up, let’s edit the file by adding the following line at the end of it and save it.

    If before that our external HDD didn’t even switch on now it’s working but I must advice you that I encountered freezes and crashes when downloading torrents.
  • Installing NTFS utility. Raspbian has not a native support to the NTFS filesystem, so we have to install a specific package. On the terminal:
  • Mounting the HDD. The automount function available on Raspian does not allow us to write on the disk, with the command lsblk on the Terminal we should get to know our disk address:

    In my case I have that my “HDD320G”‘s address is /dev/sda1 , now all we have to do io unmount it and remount with ntfs-3g creating a folder called “hdd_ext”, for example, in media with mkdir:

    Now we can finally write on our disk.

    Obviously we have to execute these commands every time we boot up our Raspberry Pi, so let’s create a bash script in /home/pi for example, called startup.sh and we will write:

    To make this self-starting we can cite it in the file /etc/init.d/rc.local, writing at the end its path:

    Please note that the line 15 is very important (as we will see in this article), lines 3 and 13 will be clear going on.

Installing and configuring Transmission

After setting up the environment we can install Transmission an open-source torrent client. We will install a daemon version, because we have a Raspberry without a display and we want monitor it from remote. Transmission daemon has a good web interface that it will allow us to achieve our purpose.

Installation

Configuration

To proceed with the configuration we have to stop the daemon (we are obliged to do it, otherwise we will lost any changes to the configuration file). Let’s edit /etc/transmission-daemon/settings.json

This is how our setting file will look like, I highlighted important lines:

  • At lines 15 and 23 we write our folders paths
  • at line 24 we enable the incomplete folder
  • at line 47 we enable the web interface
  • at line 45 we set that a password is not required to access to web interface
  • It’s important to set the line 53 on “false” or we won’t be able to access to the web interface

Final operations

  • Give the right permission We have to set that our user identity is the owner of the setting file, let’s do it:
  • Restart transmission
  • Now we can access to our web interface by typing on the browser the IP and the port which transmission will listen to (line 49 of settings.json), for example in my case 192.168.0.7:9091. This is how the interface will look like:
    Transmission's web interface

    Transmission’s web interface

    From here we can manage every torrent.

    IP Blocking

    If you want you can also add a list of bad IP to Transmission, mainly p2p filter. We have to click on wrench then Peers then Enable Blocklist  and add this link

    http://john.bitsurge.net/public/biglist.p2p.gz

    Then Update as in the picture below

    Peers page of Transmission

    Peers page of Transmission

    That’s all!Comment this post with your doubts, thoughs and suggestions!

How to install Windows or Linux from USB

If you have a netbook you can’t, obviously, set up the OS (Operating System) from a CD or a DVD. That’s why I put Rufus  forward, because using this utility it’s as easy as pie. Rufus is compatible with every Operating System, and it allows to create a USB flash drive which you can use to set up the OS, as you would do if you had the opportunity to use a DVD. Let’s observe togheter the program interface, then I’m going to show you how to create your USB flash drive.
rufus_it
1. First of all, you have to select the disk drive where you want your flash drive to be, by clicking on the first drop- down menu;
2. Don’t change anything else, like in the picture above (default options), and click on the small disk symbol on the right of the interface;
3. Select the image you prepared before and click on “Start” . The program will automatically create the flash drive.
Now you can format the computer, if you don’t know how to do click here.
Rufus | Official Site

Translated by senzacca