Raspberry Pi 2 Torrent box, Dlna Server and NAS India

October 12, 2015     noteshunt    

raspberry pi 2 box 1500x1000

In this tutorial I am going to show you how to Configure your Raspberry pi 2 for Always on Torrent box,Minidlna server and SAMBA.If you face any trouble please comment so that i can help you

On the software side, I’m using the default Raspbian image, then install the bits and pieces I need later on. There are plenty of guides on installing the image and setting up the Pi.

Hardware wise,
Step 1.
Discard the power adapter that comes with the powered USB Hub if it supplies less than 3A. You need 700mA for the Pi and 500mA for each hard drive you connected.

Step 2.
Connect the USB Wi-Fi dongle to the Raspberry Pi.

Step 3.
Connect the USB output cable from the hub to the Pi. This should also power the Pi, so no need for a mini USB cable.

Step 4.
Connect the hard drives to the hub,

Step 5.
Power on the Pi. Powering Pi before plugging in USB components may restart Raspberry Pi.


Step 2: Setting up hard drives

Step 0.
Plug in your USB Hard Drives. If you are using NTFS, install ntfs-3g.

sudo apt-get install ntfs-3g

Step 1.

ls -l /dev/disk/by-uuid

Write down drives UUID and drive paths (sda*, sdb*, sdc*…).

Step 2.


ls -l /dev/disk/by-name

Write down name and drive paths.

Step 3.
Match drive paths, names and UUID

Step 4.
Create locations for mount points for each hard drive. Replace DRIVE_NAME_* with names you like, I chose to use the same name as my disks’ name as obtained from Step 2.

sudo mkdir /media/DRIVE_NAME_*

Step 5.
Mount the USB drives

sudo mount -t ntfs-3g -o uid=pi,gid=pi /dev/sdxx /media/DRIVE_NAME*


ntfs-3g for NTFS drives
vfat for FAT32 drives
ext4 for ext4 drives

Replace sdxx and DRIVE_NAME_* from the list you have compiled in step 3 and 4.

Step 6.
Now we will configure the Raspberry Pi to mount these drives after every reboot.
Make a backup for your current fstab

sudo cp /etc/fstab /etc/backup_fstab

Add mount information to the fstab file

UUID=xxxxxxxxxxxxxx /media/DRIVE_NAME_* ntfs-3g rw,defaults 0 0

Replace with the correct UUID, mount point and drive type

Step 7.
Turn off GUI mode by using sudo raspi-config
Restart Raspberry Pi with sudo reboot

At this point, your USB drives should be mounted properly.

Step 3: Installing Transmission / rTorrent (updated 18.03.2014)

Picture of Installing Transmission / rTorrent (updated 18.03.2014)

Because this is a headless server, we are accessing the command lines through SSH. Fortunately, SSH is enabled out of the box for Raspbian.

Step 0.
Let’s update and upgrade the repositories and distribution by using:

sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade

Step 1. You can either install Transmission or rTorrent or both. Skip to Step 2.2 for rTorrent installation.
Install Transmission

sudo apt-get install transmission-daemon

In order to download torrents, we need to access Transmission’s WebUI. This can be done by running Transmission daemon (started after installation) and accessing the Pi’s internal IP address and Transmission’s designated port.

Step 2.1. Transmission setup
Next, we need to setup who can access Transmission by setting up username, password and allowed IP addresses:
1. Stop Transmission service with

sudo service transmission-daemon stop

2. Start modifying the settings:

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

3. Find rpc-username and rpc-password, change the values to your liking.
4. Find rpc-whitelist and add the IP addresses of your other computers. You can use wildcard to include a range of IP addresses, for example, in my case, 10.1.1.* is added.

Step 4: Installing Samba and miniDLNA

Picture of Installing Samba and miniDLNA

Now the important bits – mounting and setting up torrent downloading for 3 hard drives – are done. In this section, we will install Samba and miniDLNA. There are many quality guides on the internet showing you how to install Samba and miniDLNA and I recommend you to source and read them. However, for completion, steps I took to install these two services are written below.

Step 1.
Install Samba

sudo apt-get install samba samba-common-bin

Step 2.
Backup and modify Samba’s configuration file

sudo cp /etc/samba/smb.conf /etc/samba/backup_smb.conf
sudo nano /etc/samba/smb.conf
  1. Find workgroup, and modify its value. This is the workgroup your Windows machine need to be a part of to view the files
  2. Remove irrelevant drives, printers if you don’t need them
  3. Add your own drive:
comment = Some comment about this drive
path = /media/DRIVE_NAME_*
create mask = 0777
directory mask = 0777
read only = yes

read only option depends on whether you want your users to change files or not. In my case, I chose yes.

Step 3.
Restart Samba

sudo service samba restart

If you run into problems with Samba, consult online manuals and Raspberry Pi’s forum as they know a lot more about setting up Samba than I do.

Step 4.
Install miniDLNA

sudo apt-get install minidlna

Step 5.
Backup and configure miniDLNA

sudo cp /etc/minidlna.conf /etc/backup_minidlna.conf
sudo nano /etc/minidlna.conf

In the configuration file, add


so the database is saved across reboots

Change miniDLNA’s media directory to point to mount points


First parameter of media_dir is the types of files for miniDLNA to detect.

A for Audio
P for Photos
V for Videos

Add as many media directories as you need. Change names of drives as needed.

Step 5: Conclusion

Now, your Pi should be able to download torrents and access files via Samba and miniDLNA to and from 3 hard drives. The hardest part of this guide is setting up the webUI for Transmission. After that, everything should be smooth sailing.

Have fun and enjoy your server!

Categories: Raspberrypi