Friday, February 7, 2014

How to setup Raspberry Pi computer for Torrent downloading and Network Added Storage.

Aim of tutorial : How to setup Raspberry Pi for downloading Torrents and NAS.



This setup will allow one to access their hard disk drive connected to raspberry pi as a network share in windows or an android phone and also enable raspberry pi to download torrents from the internet and automatically share it on the network.  The tutorial is divided into 2 Parts as follows:

1.] Installing Samba server.
2.] Installing the Transmission Torrent Client.

Login to your Raspberry Pi as default user: 
pi user and password: raspberry
Use "sudo" with every command.

Type the following commands:

[Part 1]: Installation of Samba and Mounting an external USB Hard Disk Drive.


1.> Install SAMBA on Raspberry Pi:


sudo apt-get update
sudo apt-get install samba samba-common-bin
sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.copy

2.> Add support for NTFS drives:


sudo apt-get install ntfs-3g
sudo fdisk -l

>> Note down the drive name ( my 1TB drive was listed as: 
/sda1)

3.> Mount the harddrive and setup mount points:

sudo mkdir /media/WD1TB

4.> Configuring SAMBA:


sudo nano /etc/samba/smb.conf

Look for ############Authentication############## line

under which you need to remove the # symbol from the line: 

security = user 

and also copy paste the following lines at the end of the file:

[WD_1TB]
comment = WD_1TB
path = /media/WD_1TB
browseable = yes
writeable = yes
public = no
read only = no
valid users = pi


Use "ctrl+x" and then "y" and then "Enter" keys to Save and close the configuration file.

5.> Save and restart SAMBA service:
sudo /etc/init.d/samba restart

6.> Add Unix users: (no need to perform this step if Pi user is already exists)


sudo useradd pi -m -G users
sudo passwd pi

Enter the password twice to confirm.(Entered password will not be shown)


7.> Add pi user to SAMBA Users:


sudo smbpasswd -a pi

Enter the password twice to confirm.(Entered password will not be shown)

8.> Setup hard disk to mount automatically even if Raspberry Pi restarts:


sudo nano /etc/fstab

Enter the following line in the last and Save:


/dev/sda1 /media/WD1TB auto noatime 0 0

9.> Restart Raspberry pi:

      
sudo shutdown -r


By entering the samba user id and password in windows network, you should now be able to access your hard drive connected to raspberry Pi. 

[PART 2]: Installation of Transmission torrent client and configuration

10.> Installing Transmission Torrent downloader:


sudo apt-get update
sudo apt-get install transmission transmission-daemon transmission-cli

11.> Configuring Transmission:


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

Edit the following lines to your needs:


“rpc-enabled”: true,

“rpc-password”: “raspberry”,
“rpc-port”: “9091”,
“rpc-username”: “pi”,
"download-dir”: “/media/WD1TB/Torrent_Downloads”,
”incomplete-dir”: “/media/WD1TB/Torrent_Downloads”,
”incomplete-dir-enabled”: true,
"rpc-whitelist-enabled": false, 
Use "ctrl+x" and then "y" and then "Enter" keys to Save and close the configuration file.


12.> Creating a Downloads directory for Transmission:


cd /media/WD1TB
sudo mkdir Torrent_Downloads

13. > Start the Transmission daemon service:


sudo service transmission-daemon start

Test if the port 9091 is open:

sudo netstat -antup | grep 9091

14.> Adding Transmission to start-up automatically when raspberry pi starts:


sudo apt-get install chkconfig
sudo chkconfig --add transmission-daemon
sudo /sbin/chkconfig --level 2345 transmission-daemon on

15.> Adding User to transmission-daemon group and set up permissions:

sudo service transmission-daemon stop 
sudo adduser pi debian-transmission
sudo nano /etc/init.d/transmission-daemon
and edit the following:

USER=pi

sudo chown pi -R /var/lib/transmission-daemon/info/ 
sudo chown pi -R /media/WD_1TB/Torrent_Downloads
sudo chown pi -R /etc/transmission-daemon/settings.json 


16.> Start Transmission Daemon:


sudo service transmission-daemon start

17.> Accessing Transmission Webpage:


From any device connected to your same network,

open a browser and type:

http://192.168.2.100:9091

This will open Transmission Web-page where you can add, control and monitor your torrents.

Click on the wrench Icon at the bottom to open settings, Network and edit the port to 9092, save.

18.> Configuring Wifi-Router to forward ports for Transmission torrent downloader.


Check how to forward ports in wifi router here: Port Fowarding


Port forward ports 9091, 9092 for RPC(webserver) and Torrent respectively.


Restart the router if necessary and Raspberry Pi

After the download completes, they will automatically show up in the Network share we created in Part-1 of the tutorial.


0 comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...