Introduction: Raspberry Pi-based Torrentbox With VPN, SAMBA Shares, Hard Drive Disk and Deluge
In this article, you are going to learn how to create your very own headless Raspberry Pi based Torrentbox.
If you really enjoy this article, consider checking out my TechWizTime YouTube Channel.
And for an awesome source of Raspberry Pi Accessories, check out my Raspberry Pi Amazon List.
Let’s get started!
Step 1: What You'll Need
- Raspberry Pi 3, 2 or 1
- USB Keyboard
- Wired Internet Access
- Latest Raspbian Lite Image
- 8GB MicroSD Card
- VPN Provider for Private Browsing (Private Internet Access)
Step 2: Configure Raspbian
Log in with the username "pi" and the password "raspberry"
Type in "sudo apt update" and press "Enter"
When the updating process finishes, type in "sudo apt upgrade" and press "Enter"
NOTE: You can change your password by typing "sudo passwd" , type your new password, re-type it and it'll be changed.
Step 3: Install OpenVPN
If you don't already have a VPN, it is highly recommended to protect your privacy when browsing or downloading from the internet. I highly recommend Private Internet Access which I will be using here.
Type in “sudo apt-get install openvpn -y” and then press “Enter”
Type “cd /etc/openvpn” and press “Enter”
Type in “sudo wget https://www.privateinternetaccess.com/openvpn/ope... and press “Enter”
Type in “sudo unzip openvpn.zip” and press “Enter”
Step 4: Configurate OpenVPN to Boot at Start
Type “sudo nano login.conf” and then press “Enter”
Type your PIA’s Username on the first line.
Type your PIA’s Password on the second line.
Press “Ctrl X”, “Y” and “Enter”
Type in “sudo chmod 400 login.conf” and press “Enter”
Type in “sudo cp *COUNTRYTHATYOUWANTTOCONNECTO*.ovpn *COUNTRYTHATYOUWANTTOCONNECTO*.conf” and press “Enter”
Type “sudo nano Singapore.conf” and press “Enter”
Scroll down to the “auth-user-pass” section, press space and add “/etc/openvpn/login.conf”
Go down to “crl-verify” and add “/etc/openvpn/”
Move down to “ca” and type in “/etc/openvpn/”
Press “Ctrl X”, “Y” and “Enter”
Test if the configuration works by typing “sudo openvpn *COUNTRYTHATYOUWANTTOCONNECTO*.conf” and press “Enter” If it works, press “Ctrl C” to finish the connection.
Type in “sudo nano /etc/default/openvpn” and press “Enter”
Create a new line under the last “AUTOSTART” and type in “AUTOSTART=”COUNTRYTHATYOUWANTTOCONNECTTO””
Press “Ctrl X”, “Y” and “Enter”
Reboot your Raspberry Pi by typing “sudo shutdown -r 0”
Log in with the username “pi” and the password you set up before.
Type in “curl http://ipinfo.io/ip” and press “Enter”
Compare the IP Address to check if you’re using OpenVPN
Step 5: Set Up Your HDD
Connect your HDD by USB to the Raspberry Pi.
Type in “sudo umount /dev/sda1” and press “Enter”
Type “sudo parted /dev/sda” and press “Enter”
You can press “P” to check the partitions at any time.
Type in “mktable msdos” and then press “Enter”
Press “Y” to continue.
Type in “mkpart primary ext4 0% 100%” and press “Enter”
Type “print” and then press “Enter” to check if the partition was created successfully.
Type “quit” and press “Enter”
Type in “sudo mkfs.ext4 /dev/sda1”
Press “Y” if it asks for confirmation.
Type in “sudo mkdir /mnt/torrents” and press “Enter”
Type in “sudo mount /dev/sda1 /mnt/torrents” and press “Enter”
If you want to check if it was successful, type “df -h” and press “Enter”, it should display at the bottom.
Type in “sudo nano /etc/fstab” and press “Enter”
Create a new line under the last “/dev” and write “/dev/sda1 /mnt/torrents ext4 defaults 0 0” (Using the spacing shown in the folder)
Press “Ctrl X” “Y” and “Enter”
Type “sudo reboot”
After it reboots, type “df -h” to check if the configuration is saved.
Step 6: Install Deluge
Type in “sudo apt install deluged -y” and press “Enter”
Once it finished downloading, type in “sudo service deluge-web -y” and press “Enter” Type in “cd /mnt/torrents” and press “Enter”
Type “sudo mkdir downloading” and press “Enter”
Type “sudo mkdir completed” and press “Enter”
Type “sudo mkdir watch” and press “Enter”
Type “sudo mkdir backups” and press “Enter”
You can type “ls -la” to verify that the folders are created”
Type in “ifconfig” to check your IP Address, write it down because we’ll need it later.
Start Deluge by typing “sudo service deluged start”
Type in “deluge-web”, press “Enter” and wait for it to finish.
Step 7: Configure Deluge
Go to your PC and open up a web browser.
Go to the following address “YOURIPADDRESS:8112”
The login password is “deluge”, after typing it, you should receive a message telling you that you should change it, do it now if you wish.
Look for your Raspberry Pi on the small prompt that will appear (It should be the only one) and click on “Start Daemon” and then hit “Connect”
Go to “Preferences”.
Click on the “Downloads” tab.
In the “Download To” bar, type in “/mnt/torrents/downloading/”
Tick the “Move Completed To” and type in “/mnt/torrents/completed/”
Tick the “Autoadd .torrent files from” box and type in “/mnt/torrents/watch”
Tick the “Copy of .torrent files to” box and type “/mnt/torrents/backups”
Click “Apply”
Click “Ok”
NOTE: If you try to add a torrent right now, an error will pop up, this is due to a permissions conflict.
Go back to the Raspberry Pi and press “Ctrl C” to interrupt Deluge.
Type in “sudo chwon -R pi:pi /mnt/torrents/” and press “Enter”
To check that it worked correctly, type in “ls -la /mnt/torrents/” and press “Enter”
Type in “deluge-web” and press “Enter”
Go back to the computer.
Add your torrent file, and it will download.
Step 8: Personalize Your Raspberry Pi
Type “sudo raspi-config” and press “Enter”
Scroll down to “Localization”
Change Your Keyboard Layout: Go down to “Change Keyboard Layout”
Keep it on the “Default English 105 Key”
Go down to “Other”
Choose the language of your keyboard from the list.
Keep the remaining settings on Default.
Change The Timezone: Go down to “Change Timezone”
Choose your continent or region.
Choose your country.
Remove Overscan: Go down to “Advanced Options”
Scroll down to “Overscan”
Choose “No”
Reduce The GPU Memory: Go down to “Advanced Options”
Choose “Memory split” Change “64” to “16”
Hit “Ok”
Go down to “Finish”
Select “Yes”
Step 9: Autostart Deluge
Type “sudo nano /etc/rc.local” and press “Enter”
Create a new line under the last one and type in ”
# DISPLAY IP ON REBOOT
_IP=$(hostname -I) || true
if [ “$_IP” ]; then
printf “\n*************************************************\n”
printf “Connect to Deluge via http://%s:8112 (Without the space)\n” “$_IP”
printf “*************************************************\n\n”
fi
# DELUGE START ON BOOT
sudo -u pi /usr/bin/python /usr/bin/deluge-web &
exit 0″
Press “Ctrl X” “Y” and “Enter”
Type “sudo reboot” and press “Enter”
Step 10: Set Up SAMBA Shares
Type in “sudo nano /etc/samba/smb.conf”
Scroll down to “win support”
Delete the “#” and change “no” to “yes”
Go to the very bottom and type in “[TORRENTS]
comment = Torrents
path = /mnt/torrents
create mask = 0755
directory mask = 0755
read only = no
browseable = yes
public = yes
force user = pi
only guest = no”
Press “Ctrl X”, “Y” and “Enter”
Type “sudo reboot” and press “Enter”
NOTE: If it doesn’t works, try typing “sudo apt install samba samba-common-bin -y” and then reboot with “sudo reboot”
To access from a Windows pc, all you have to do is type “\\YOURHOSTNAME” or “\\YOURIPADDRESS”
When it asks for a login information, the username will be “pi” and the password is teh same one you use to log into your Raspberry Pi.
Congratulations, you’ve just created your very own Raspberry Pi-based Torrentbox, added a VPN to it, configured SAMBA Shares and even changed the host name and that’s it for this Instructable.
If you enjoy this Instructable, consider checking out my TechWizTime YouTube Channel.
And for a good source of Raspberry Pi products, check out my Raspberry Pi Amazon List.