2. Torrent server

So now all that your web server is up and running, and you have a Dynamic DNS name (if you chose to do that), here’s how I set up the torrent server on the pi (using transmission) credit goes to this website for helpful instructions. I also had a spare 500gb external harddrive (externally powered too) that I am using as storage for the downloads (I only have a 4gb SD for the pi) so instructions for setting this up, credit goes to this webiste

First up, lets set up the hard drive on the pi. I tried the normal way of mounting the hard drive but I ran into the issue on the above link about the hard drive being mounted in read only, so lets just install some other programs to help us out

sudo apt-get install ntfs-3g

Once this is done, plug your hard drive in and power it on. to find out where your hard drive is located run

sudo fdisk -l

This will give you output similar to this:

Disk /dev/mmcblk0: 3974 MB, 3974103040 bytes
4 heads, 16 sectors/track, 121280 cylinders, total 7761920 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000c7b31

    Device Boot   Start     End   Blocks  Id System
/dev/mmcblk0p1      8192   122879    57344  c W95 FAT32 (LBA)/dev/mmcblk0p2     122880   7761919   3819520  83 Linux

Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x8d399bc0

 Device Boot   Start     End   Blocks  Id System
/dev/sda1       63  976751999  488375968+  7 HPFS/NTFS/exFAT

We can see that my 500 gb hard drive is at the location /dev/sda from the output above. So before we mount it we need to make a folder to mount the hard drive in

sudo mkdir /mnt/usb

Now we can mount the hard drive

sudo mount /dev/sda1 /mnt/usb -t ntfs

You can check to see if its mounted with

df -h

and you should see it in the list as /dev/sda1 mounted on /mnt/usb:

Filesystem   Size Used Avail Use% Mounted on
rootfs     3.6G 2.1G 1.4G 62% /
/dev/root    3.6G 2.1G 1.4G 62% /
devtmpfs    235M   0 235M  0% /dev
tmpfs      49M 636K  48M  2% /run
tmpfs      5.0M   0 5.0M  0% /run/lock
tmpfs      98M   0  98M  0% /run/shm
/dev/mmcblk0p1  56M  19M  38M 33% /boot
/dev/sda1    466G 215G 252G 47% /mnt/usb

I also made another folder on the hard drive

cd /mnt/usb
sudo mkdir torrents
sudo chmod 777 torrents

I give this folder full permissions ( its probably not best practice but I know it works when its like this..)

So now we can get transmission server up and running, finally. Thanks to thisguy for some helpful instructions to get our torrent server up and running\

sudo apt-get install transmission-daemon

We already set up a save folder previous at /mnt/usb/Torrents so I just used this for both complete and incomplete torrents (but you can make yourself another folder to store incomplete files in if you want). Now we customise the settings file

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

Now you can scan through and change the settings as desired (its pretty self explanatory) but here is a list of the setting I changed

"download-dir": "/mnt/usb/Torrents",
"incomplete-dir": "/mnt/usb/Torrents/",
"incomplete-dir-enabled": true,
"rpc-password": "put desired password here"
"rpc-username": "pi",
"rpc-whitelist": "127.0.0.1,*.*.*.*,192.168.*.*",

The rpc-whitelist is there to give access to certain IP address’s to the web front-end of transmission. ... gives access to the world, as I connect to the server with my phone while out and about to upload torrents and such. But you can restrict it to your local LAN/work IP’s or whatever you need. All the rest of the settings you can modify as needed to suit. Now we want to reload the server to save our settings

sudo service transmission-daemon reload

Once this is done you can restart it as necessary, as explained on the above webpage, reloading it will save the config, but restarting it will override it

You should now be able to access it through your x.x.x.x:9091 ( Mine is accessible at 192.168.0.5:9091 )

So there’s also a nifty transmission android app that you can then remotely upload torrents to your server to download https://play.google.com/store/apps/details?id=com.neogb.rtac

The last thing you need to do is forward the right ports out of your home router so you can access your pi over the internet. I have a netgear so there’s plenty of online guides on how to do it, it’s pretty straightforward though. you will need to forward on port 80, and 9091