Torrent Box

I am going to use the Deluge torrent server/client program for this tutorial. Not for a specific reason but because I am using this one on the present time. The tutorial will work (with a few changes into the configuration file of course) for any other torrent program, like the really popular transmission.

Pay attention to this! By law, you are allowed to share only legal files, documents, softwares etc. All the other files are illegal for sharing! In other words… use only legal files and nothing more!


Install Deluge daemon on the Raspberry Pi

So, its time to begin with the actual tutorial. Open a terminal connection with the Raspberry Pi and as usual update, upgrade and perform a reboot on your Pi:

sudo apt-get update
sudo apt-get upgrade
sudo reboot

Now type the following to download the Deluge daemon and console installation packages. We need both of those, not only the Deluge software as we will use a thin-client style configuration with remote access and management:

sudo apt-get install deluged
sudo apt-get install deluge-console

After Deluge has finished installing, we must run the daemon and then we have to shut it down:

sudo pkill deluged

This process sounds strange but its the only method that creates the configuration file than we want. We’re going to edit this file and then start the daemon again:

sudo nano ~/.config/deluge/auth

Once inside nano, you will see a big alphanumeric string (photo bellow) with the following convention: user:password:level

Where user and password are the username/password you want for Deluge respectively and the level is the access permission you are going to have. The number 10 creates a full-access/administrative level for the daemon and I am always using this one. After you edit the file with the names you want, press Ctrl-X, Y and then Enter to save the changes. Then type the following to start the Deluge and Deluge-Console:


Now it suppose to have the console interface on your screen:

If the console gives you error codes instead of nice cleanly formatted console interface like above, type “exit” and then make sure you’ve started up the daemon and you have follow the previous steps without any mistake. After you do that and the console interface is loaded as I am sowing above type:

config -s allow_remote True
config allow_remote

Press Enter between the lines for the console to process the commands. In case you do a spelling mistake you will have a red line like I did with my first command. Just type the command again and you will be fine.

These commands will enable remote connections to your Deluge daemon. Its time to kill the daemon and restart it one more time so that the configuration changes take effect:

sudo pkill deluged


Create the parent directory

All the torrent server/client programs support a good level of organisation with the files they are working on. Deluge in not an exception to this rule. It can handle and populate directories for downloading torrents, completed torrents as well as for automatic loading of new files.

To be clear, the same directory can be used for all of those but I prefer the clean and organised method to put everything in appropriate directories. Type:

sudo mkdir /media/USB

This will make the parent directory and under this one we will create the Completed, Downloading and Incoming folders. The mount of the external storage device will point to this parent directory as well.


Mount the external disk

You can use any USB ready storage here. From a simple USB stick to a regular HDD or a new tech SSD. But despite the storage media type, you have to mount this on the system. First, plug the external storage to any available USB port of your Pi. Have in mind that if you don’t use a USB stick you must use an external USB powered HUB to power the HDD/SDD. To mount it, you have to find the name of the device first:

sudo fdisk -l

and the result will be a list like this one:

We are looking for the last like starting with /dev/.. . Next, we are going to format this drive under ext4. This is the file system of choice of Linux and will make the things easier for processing by the RPi. You can use any file system but I strongly recommend ext4 for this setup. The drivers and everything else will work better/faster using this compared to installing “middle man” packages for supporting NTFS or HFS+.

To format the drive with ext4 type:

sudo mkfs.ext4 /dev/sda1 -L untitled

After the process finish (it will take a few seconds depending on the storage device size), type the following command to mount your device to the desired location of your choice (I am using the previous created directory)

sudo mount -t ext4 -o uid=pi,gid=pi /dev/sda1 /media/USB

Have in mind that my external device is a 32GB SanDisk USB stick, formatted under ext4 as I told above. If you are using another format type, despite my suggestions, then use vfat for FAT32 drives or ntfs-3g for NTFS drives in the position I am writing ext4. You need to install a few packages to support NTFS, its not working out of the box.

Before the end of this section, we must change a few things for automatic mounting every time the Raspberry Pi is booting as it will be a waste of time to do the mounting process over and over again after every power cycle.

sudo nano /etc/fstab

In this screen we must add a new line just before the end. This will be:

/dev/sda1 /media/USB ext4 uid=pi,gid=pi 0 0

Save the changed (Ctrl-X, Y, Enter) and then its time to change the permissions of the entire parent directory:

sudo chmod 777 -R /media/USB

Finally, create the next remaining folders that will be used by the Deluged:

sudo mkdir /media/USB/Downloading
sudo mkdir /media/USB/Completed
sudo mkdir /media/USB/Incoming


Configure Deluge on PC

At this point we are ready with the daemon installation on the Raspberry Pi together with the peripheral packages and configs needed for the project. Its time to install the Deluge on the PC/Laptop side. You can find the latest release here. Just select the operation system you want and then the latest version. Don’t use beta versions if you don’t know what you are doing. Stay with the tested ones and you will be OK!

Asther the PC installation finish, run the program and go to Preferences -> Interface and unselect the classic mode interface:

Click OK and restart the program. This time, when Deluge start, will present you a new window (Add Host) to configure a remote connection

On the Hostname section type the IP address of your Pi and on the Username/Password type the credentials you added here: user:password:level on one of the previous steps. Leave the Port section as it is and press Add

The next screen is the Connection Manager. If the previous step went ok you will have a green circle just under the Status area. If not, this circle will be red and you have to check for any spelling mistakes with the previous step. You can add multiple remote connections (aka multiple Raspberry Pi’s running Deluge) and manage all of those by selecting them from here.

Press Connect and the main window of Deluge will be ready to accept torrents and manage the ones already loaded from previous sessions.


Samba for remote access

Under Construction
Under Construction
Under Construction
Under Construction
Under Construction


Leave a Reply

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

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

Google+ photo

You are commenting using your Google+ 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 )

Connecting to %s

%d bloggers like this: