Turn Raspberry Pi in an always on download machine

Turn Raspberry Pi in an always on download machine
November 28, 2015 12:45:45

A problem that many PC users are facing, especially those who have a power PC, is that when they want to download a huge file from the internet, they have to leave their PC open, something can may affect their electricity bill. Here is a tutorial on how to make a cheap Raspberry Pi an always on download machine.

I chose Raspberry Pi because is cheap (Zero has a very low price ($5), has low power consumption, is noiseless and has a huge fan base. Of course there are already similar machines out there, however their price is out of comparison with a Raspberry Pi.

To make things more simple, we have to make it once and put it in a corner, without having to check it again. So, we have to browse in our files and of course, to add or remove torrents from our PC.

First, we have to install the latest version of the Raspbian. In a PC with Windows, use Win32 Disk Imager to write the Raspbian image on an SD Card.

Insert the SD Card, add your USB HDD and the Wi-Fi adapter and turn it on. If you have a USB HDD without its power supply, or if you want to add more USB stuff, you must use a powered USB Hub, because Raspberry Pi can't power them.

After the booting, you will see the desktop. From there, connect to your network and open a terminal window. There, run these commands, before continue:

sudo su
sudo apt-get update
sudo apt-get upgrade

Our next step is to auto-mounting our HDDs. Run the command below, to view a list with the HDDs:

sudo fdisk –l

We want to find out the boot name from our HDDs, in my case was "/dev/sda1". After that, run these commands:

sudo chmod 775 /mnt
sudo nano /etc/fstab

Go to the last line, and put this command at the end. As "sda1" use the boot code from the HDD you have. So, for one HDD put:

/dev/sda1 /mnt /ntfs defaults 0 0

Now, every time your system boots, it will auto-mount the HDD. Next, we have to install some software we need.

Iceweasel (Firefox)
Far better from the default browser and with the sync, you can have your Firefox's bookmarks there too.

sudo apt-get install iceweasel

Rar
Raspbian supports zip files, but we need support for rar files, too. To add support for rar files, run

apt-get install unrar-free

Transmission (BitTorrent client)
A download box needs a good BitTorrent client. I chose Transmission because you can manage your torrents within your browser. When finishing installing Transmission, run it and go to settings and in "Remote" tab. From there, choose "HTTP Port" and disable the authentication settings.

sudo apt-get install transmission

You can manage your torrents within another PC.

In order to make Transmission run every time you system boots, run this command:

sudo nano /etc/xdg/lxsession/LXDE-pi/autostart

go to the end and put this command below and save the file after that:

@transmission-gtk

Samba
In order you can have access to Raspberry's files, you need Samba. To install it, run this command:

sudo apt-get install samba

Now, you have to set it up, so you can share your files in your network. Run this command:

sudo leafpad /etc/samba/smb.conf &

From the settings, you have to change this:

wins support = yes

In order to have access, go to "Share Definitions" and change the settings. With "only guest" and "public", we are telling the system to ask for a password every time someone wants to connect with it.

[pihome]
comment= Pi Home
path=/home/pi
browseable=Yes
writeable=Yes
only guest=no
public=no
read only=yes

To add your HDD there, go to "Share Definitions" and put the below commands. As "Toshiba", i putted the name of my HDD. You can put everything there. The name in square brackets is the name you will see in your network, so name it with something you want to separate this HDD from the others. This is for one HDD, you have to repeat this for every HDD you have connected on Raspberry Pi. Note, in your HDD you have to add "read only = no" command, otherwise you will not be able to edit your files remotely.

[Toshiba]
comment= Toshiba HDD
path=/home/pi/TOSHIBA
browseable=Yes
writeable=Yes
only guest=no
create mask=0777
directory mask=0777
public=no
force user = root
read only = no

When finish, run the below command and it will ask you to twice to add a password. This password will be the network password (the username is always pi).

smbpasswd -a pi

Now reboot the system and from another PC go to your "Network". Normally, you will see the Raspberry and everything you putted in "Share Definitions". You will be asked for a password, put the password you selected above. You can save this password, so you don't have to write it every time.

Now you can browse in the HDD's files from any PC you have in your network. I decided to have my system connected with Wi-Fi and not with cable, to avoid using cables, but it has an impact in the speed between PCs.

You can also stream your movies or music you have in this HDD.