Introduction: Make Your Own TorrentBox From a Pi

Here you can read how to build a 24/7 running torrent server created a Raspberry Pi. All steps will be explained below. If you want a very low power-consumed server which can share your torrents by all day-and-night.

Step 1: Parts for the Build

Here I'm writing what parts you can buy to create the server.


Raspberry Pi:
Raspberry Pi 2: https://www.adafruit.com/products/2358

OR

Raspberry Pi 3: https://www.adafruit.com/products/3055


Important that whatever device you'll choose you need a 5V 2.1A power supply for it, at least!

Power supply: https://www.adafruit.com/products/1995

And a SD card (min: 8GB, req: 16GB)!

http://www.ebay.com/sch/8GB-Micro-SD-Cards/96991/b...

Case: (optional)

You can choose a case for it just to make it all-together, but it's not required.
here is mine: https://www.wdc.com/en-ie/products/wdlabs/wd-pidr...
It's a 6x6 enclosure case, because I wanted to put the HDD with the pi together in one case.
But you can find a lot of cases here: https://www.adafruit.com/categories/395

Drive:

314GB: https://www.wdc.com/en-ie/products/wdlabs/wd-pidr...

1TB: https://www.wdc.com/en-ie/products/wdlabs/wd-pidr...

You can use any 2.5" HDD the higher RPM is better for torrent.


All of the parts can be found on eBay also!

Step 2: Prepair Every Parts You Have

After everything is here let's put all things together, setup the server, before start to install the torrent program and the necessary apps.

Note: After you put together the case with the Pi and the HDD, you have to install an OS, I prefer Raspbian. It's a modified Debian Linux for Raspberry Pi.

You can find the installation steps here if haven't used raspberry before:
Windows: https://www.raspberrypi.org/documentation/install...

Linux: https://www.raspberrypi.org/documentation/install...

Mac: https://www.raspberrypi.org/documentation/install...

Step 3: Put Your Pi Into the Case First

As you can see on the top-right part you can put the raspberry with screws to hold onto it.

Maybe you noticed that I put heatsinks onto the pi - on the CPU and RAM - because it will run on 24/7 and always downloads and uploads so it'll work a lot. That's the point why I wanted to use heatsink, but it's just an advice.

Step 4: Put the HDD Next to the Pi

Here I put the HDD next to the Pi and of course I used screws to hold, all screws parts of the package of the case.

If stuck someway, you can check the guide for the case: https://www.wdc.com/content/dam/wdc/website/downl...

Step 5: And the Server Is Done, Let's Install

After you set the OS on the Pi we can start the installation of the TorrentBox.
First we need these programs:

- Transmission: it's a torrent client program that will run your torrents on your raspberry pi.

- Barracuda: (optional) it's a file server program I use it because I share folders with other computers and I can use it with Webdav or FTP.

- Bittorrent Sync (or Resilio Sync): (optional) Just a synchronize program that is used to sync files amoung computers.

Now you need a computer or if you want to work on the device directly connect a Monitor, a mouse and the keyboard!

Step 6: Format Your HDD

First you need to format you HDD at least to ext3, I recommend ext4 for linux.
On the terminal typer: sudo fdisk to see which is the connected HDD drive, in my case it was /dev/sda. So type sudofdisk /dev/sda.

Type p to verify the partition if you have.
"Disk /dev/sda: xxx GB, xxx bytes"

Now, use "d" command to delete the partition, then "p" to verify the delete. Use "n" to create a new partition, "p" for primary, then hit "Enter" to default 1, "Enter" select first sector, "Enter" select last sector for the whole disk.

Now use "p" to see your new partition.

Device Boot Start End Blocks Id System
/dev/sda1 2048 234441647 117219800 83 Linux

Then to apply the changes type "w". And run "fdisk -l" to see you /dev/sda1 has been created.

Now, make your filesystem like ext3 or ext4.
"mkfs.ext4 /dev/sda" // Now the superblocks are created.

You can mount the drive with: "mount /dev/sda1 /MY_DISK_FOLDER"

Use "df" to verify you mounted drive.

Step 7: The Mighty "Transmission"

That's the main part of a torrent server. Let's install the Transmission on your Pi.

On terminal:

1. Updates:

sudo apt-get update

sudo apt-get upgrade

2. download the program

sudo apt-get install transmission-daemon

3. recommended to create folders on your HDD like completed and inprogress

sudo mkdir -p /media/NASHDD1/torrent-inprogress
sudo mkdir -p /media/NASHDD1/torrent-complete

4. now need to make a few changes in the settings.json file of the transmission

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

5. Here some changes but there are a lot, these are the most important ones

"incomplete-dir": "/media/NASHDD1/torrent-inprogress",

"incomplete-dir-enabled": true,

"download-dir": "/media/NASHDD1/torrent_complete",

"rpc-password": "Your_Password",

"rpc-username": "Your_Username",

"rpc-whitelist": "192.168.*.*",

You can find the whole settings here.

6. Save your changes and restart transmission by

sudo service transmission-daemon reload

7. You will need to update some places and permisssions so stop transmission service now

sudo service transmission-daemon stop

8. Edit the daemon to use the user that starts the service

check sour directory "ls -l /your_directory/download_dir"

sudo nano /etc/init.d/transmission-daemon

9. Edit the user that runs the service and owns the directory for the stored downloads (your USERNAME instead of debian-tranmission)

USER=YOURUSERNAME

10. Because of the user change we need to modify permissions for files

sudo chown -R youruser:youruser /etc/transmission-daemon

sudo chown -R youruser:youruser /etc/init.d/transmission-daemon

sudo chown -R youruser:youruser /var/lib/transmission-daemon

11. To avoid error on relaunching the service type this

sudo nano /etc/systemd/system/multi-user.target.wants/transmission-daemon.service

12. change the user for yours

user=YOURUSERNAME

13. reload the systemctl file

sudo systemctl daemon-reload

14. Next we need to create the directory where the setting.json file will be accessed by the transmission-daemon. Then we need to create a symbolic link (ln) back to the settings file we have already edited, update "username" with the relevant username. (If don’t do this then transmission will create a default file in its place)

sudo mkdir -p /home/username/.config/transmission-daemon/

sudo ln -s /etc/transmission-daemon/settings.json /home/username/.config/transmission-daemon/

sudo chown -R username:username /home/username/.config/transmission-daemon/

15. restart service

sudo service tranmission-daemon start

16. Now you can check the webui on your localhost

your_pi_address= 192.168.*.* or localhost

http://your_pi_address:9091

Do not set the user to root for transmission as this will involve a lot of security issues!

Step 8: The Next Few Steps Are for the BarracudaDrive and Sync - Just Optional

BarracudaDrive

First type this in terminal:

"The following text box contains all required commands for installing or upgrading FuguHub (BD). Click the text box below, copy (CTRL-C), and paste into your SSH window."

pushd /tmp/;rm -f install.sh;wget FuguHub.com/releases/raspberrypi/install.sh;chmod +x install.sh;sudo ./install.sh;popd

Configuring:
sudo service bdd stop
sudo service bdd start
sudo service bdd restart

Use su-
sudo su bd

step into your HDD folder

cd /YOUHDDFOLDER/

create a folder for BarracudaDrive

sudo mkdir BD_FOLDER

make your permission changes for bd user

sudo chown bd:daemon /YOURHDDFOLDER/BD_FOLDER

need to create a soft link in the BD directory

pi@raspberrypi ~ $ sudo su bd

bd@raspberrypi /home/pi $ cd /home/bd/disk/

bd@raspberrypi ~/disk $ rm HDD_FOLDER

bd@raspberrypi ~/disk $ ln -s /HDD_FOLDER/BD_FOLDER /HDD_FOLDER


Right now you can map your drive folder in Windows, Mac and Linux as Webdav folder.

Example how to map for Windows and Mac:

To check your file server: go to web browser and type it:

http://RASPBERRY_PI_ADDRESS/fs

Now, you have the BarracudaDrive on your Raspberry Pi. More info about BarracudaDrive here.

Step 9: Only Thing's Left Is the Sync

Resilio Sync (Bittorrent Sync)

To synchronize your files with other persons or just to sync a folder with another device use Sync.
Installation:

if you haven't done this a while the do: sudo apt-get update && sudo apt-get upgrade

1. sudo nano /etc/apt/sources.list.d/btsync.list

2. put these into the file:

deb http://debian.yeasoft.net/btsync wheezy main contrib non-free

deb-src http://debian.yeasoft.net/btsync wheezy main contrib non-free

3. import the key:

sudo gpg --keyserver pgp.mit.edu --recv-keys 6BF18B15

sudo gpg -armor --export 6BF18B15 | sudo apt-key add -

4. install

sudo apt-get update

sudo apt-get install btsync

During the installation you will have to choose your options, here are some of you may need:

default port: you can choose whatever you like: e.g.: 88024 all other things except password you can leave as the installer says.

Note: if somethings happen: sudo dpkg-reconfigure btsync you can reconfigure your btsync.

5. to use: browser

http://YOUR_PI_ADDRESS:Port

You can choose what devices you want to connect with or you can create a 3 days link for sharing.

More information about Sync here.

Step 10: Enjoy Your TorrentBox With a Lot of Extras :)