In this article, you are going to learn how to create your very own headless Raspberry Pi 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!
Table of Contents
Hardware List
- Raspberry Pi 3, 2 or 1
- USB Keyboard
- Wired Internet Access
- 8GB MicroSD Card
Software List
- Latest Raspbian Lite Image
- VPN for Private Torrenting 🙂
Configure Raspbian
Log in with the username pi and the password raspberry
Next, we are going to update and upgrade our Raspberry Pi’s Raspbian System.
sudo apt update
sudo apt upgrade
NOTE: You can change your default password for extra security using the following command
sudo passwd
Install OpenVPN
sudo apt-get install openvpn -y
cd /etc/openvpn
sudo wget https://www.privateinternetaccess.com/openvpn/openvpn.zip
sudo unzip openvpn.zip
Configurate OpenVPN To Boot At Start
sudo nano login.conf
On the first line, type in your PIA Username.
On the second line, type in your PIA Password.
To save this file, press Ctrl X then Y then Enter
sudo chmod 400 login.conf
sudo cp *COUNTRYTHATYOUWANTTOCONNECTO*.ovpn *COUNTRYTHATYOUWANTTOCONNECTO*.conf
Now we are going to edit the newly copied CONF file
sudo nano *COUNTRYTHATYOUWANTTOCONNECTO*.conf
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 add
/etc/openvpn/
To save this file, press Ctrl X then Y then Enter
Test if the configuration works by typing
sudo openvpn *COUNTRYTHATYOUWANTTOCONNECTO*.conf
If it works, press Ctrl C to finish the connection.
sudo nano /etc/default/openvpn
Create a new line under the last “AUTOSTART” and type in
AUTOSTART=”COUNTRYTHATYOUWANTTOCONNECTTO”
To save this file, press Ctrl X then Y then Enter
Now we just need to reboot the Raspberry Pi
sudo shutdown -r 0
Once we have rebooted and logged back in we can check if the VPN connected.
curl http://ipinfo.io/ip
Compare the IP Address to check if you’re using OpenVPN
Set Up Your HDD
Connect your HDD by USB to the Raspberry Pi.
sudo umount /dev/sda1
sudo parted /dev/sda
You can press P to check the partitions at any time.
Next we need to create the filetable.
mktable msdos
Press Y to continue.
mkpart primary ext4 0% 100%
To check if the partition was created succesfully, input
If everything looks good, we can exit the tool
quit
Now we can create the EXT4 filesystem on the partition.
sudo mkfs.ext4 /dev/sda1
Press Y if it asks for confirmation.
Now we will create and mount the hard drive.
sudo mkdir /mnt/torrents
sudo mount /dev/sda1 /mnt/torrents
To check if it worked, use the following command and you should see the mount point at the bottom.
df -h
We want this hard drive to be mounted everytime we reboot. So we need to do the following.
sudo nano /etc/fstab
Create a new line under the last /dev and write
/dev/sda1 /mnt/torrents ext4 defaults 0 0
To save this file, press Ctrl X then Y then Enter
Another reboot.
sudo reboot
After rebooting, we can check to see if the partition was automatically mounted.
df -h
Install Deluge
To install deluged and access it from a web browser, we need to install the following.
sudo apt install deluged -y
sudo apt install deluge-web -y
Now we can create the folder structure for our Torrentbox.
cd /mnt/torrents
sudo mkdir downloading
sudo mkdir completed
sudo mkdir watch
sudo mkdir backups
sudo chown -R pi:pi /mnt/torrents/
Now let’s check that we have all the folders created
ls -la
We need to check what our IP Address is so make sure you write it down.
ifconfig
Start Deluge by typing
sudo service deluged start
And let’s start the web-client too
deluge-web
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”
Configure Raspbian
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”
Autostart Deluge
sudo nano /etc/rc.local
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 BOOTsudo -u pi /usr/bin/python /usr/bin/deluge-web &
exit 0
To save this file, press Ctrl X then Y then Enter
Another quick reboot to seal the deal
sudo reboot
Set Up SAMBA Shares
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”
To save this file, press Ctrl X then Y then Enter
Now we need to reboot the Raspberry Pi once again.
sudo reboot
NOTE: If it doesn’t works, try installing samba and doing another reboot.
sudo apt install samba samba-common-bin -y
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.
Raspberry Pi Torrentbox Completed
Congratulations, you’ve just created your very own Raspberry Pi Torrentbox, added a VPN to it, configured SAMBA Shares and even changed the host name and that’s it for this tutorial.
Could you do everything by yourself? Did you had any problems during the tutorial? Have any suggestion? Then leave a comment below.
got an issue, seems as though the deluge-web service isn’t starting. I get the error no such file or directory. what do i do? adding the command to the rc.local doesn’t seem to work. Worked fine until i changed the hostname.
changed the name back and it didn’t do anything.
I’ll be doing a re-install soon of mine as I’m upgrading to a Raspberry Pi 3 so I’ll test it out again and see if I have any issues 🙂
I am having the same issue on Rasberry Pi3. You have any luck?
last line should not have ( ” )only guest = no”
Should be only guest = no
You should be good to go.
Awesome tutorial btw.
samme issue here, any update?
Hey Mate,
Good tutorial just found aTYPO that caught up myself for a while
sudo apt install deluged -y
sudo service deluge-web -y “should be apt install deluge-web -y”
Thank you kind sir for picking that up. Late night typing never ends well 🙂
Hey, I followed the steps as listed until I got to “cd /ect/openvpn” and it get the reply no such file or directory. Any ideas on how to solve this?
5
What speeds is the Raspberry Pi able to maintain (ie 10mbit, 30mbit, 100mbit, 300mbit) and where would you guess the bottlenecks might be? (ie cpu, ram use, data bus, etc.) I’ve heard someone suggest about 10megabytes/second may be about as fast as an R-pi works due to some bus limit, whether this would be the case or be even slower for torrent or have a different bottleneck i’d be very curious.
Knowledge of bottleneck might suggest alternative single board computers many of which suggest higher performance in some ways.
I find optimally you can get 20mbps. A lot depends on the quality of the VPN, the swarm, the Raspberry Pi edition, etc. A VPN imposes a fair amount of overhead and stress on the resources of the Pi, as the stream has to be encrypted using CPU. However, for light to medium use this project is a great idea.
Possible to add filbot to this setup?
Hello Thank you for the Tutorial.
But im facing a problem with the deluge-web to autostart, it just dont auto start.
I have typed this is in the sudo nano /etc/rc.local
# 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
–
Now im also facing a problem when i start the web-deluge manually the webserver never start.
4.5
I enjoy your channel.I look forward to doing some of those projects When im not a broke ass student.
Torrent Box
Also the twitter part on your give away is broken
I’ll look into it shortly. Thanks for the heads up 🙂
Always interesting.
Planning to use this pi as a home assistant server! Home automation FTW!!!
good post man
Looking forward to seeing more videos and guides from you soon! I always wanted to build something like this 🙂
Cool. When I get a raspberry pi I am surely gonna do this
I want to do something similar to this but for a Raspberry Pi local cloud
I have done the same as above but with much easier with ‘DietPi rpi image ‘ which has a lot of these software pre-configured.
Please check and try this, very neat and specially made for many SBC’s
http://www.dietpi.com/
Good Tutorial. Thanks
It’s amazing what this little device can do 🙂
Thanks for the video! This has my noggin spinning…can I get NetFlix running in RetroPie? If I win the Pi Kit, I’ll make it happen! Stay tuned!
Awesome, easy to follow guide.
Thanks!
How awesome is that
I made this with my R-Pi B, works super! Thanks a lot!
stand alone network plex and torrent box with auto rss
Hi Jonathan,
Thanks very much for all your videos and information. I currently have a RaspPie and Pi-Hole running successfully and would like to learn how to setup a SABnzbd/Sonarr/Radarr RaspPi3 box next.
All the best,
JStar73.
Canberra, ACT.
use dietpi image
http://dietpi.com/phpbb/viewtopic.php?f=8&t=5&sid=c15b9a581feb071348e9a5b5a3bffe18
Thanks for the tutorial, m8.
PM
Amazing Tut Man Keep it going … We waiting for more ..!!
Good post bro, Thanks
Great tutorial, would definitely give this a shot if i won the Raspberry Pi Complete Kit Giveaway
I like Retropie
Have to say I prefer Deluge on my unRAID box with VPN but the tutorial is excellent and clear as always!
Quad boot rasp pi
Hi there, Im looking to build a retropie – also to try and play around with some coding with a raspberry pi 🙂
HMMMM…. NAS IS COOL
I really enjoy your videos, please keep them coming, I’m going to try and make the torrent box soon!
Great tutorial.
Nice tutorial, easy to follow. I would totally try this if I won the RPi giveaway!
Nice Tutorial
A great tutorial. 😀
Nice tutorial. Thanks
Good article.
Amazing tutorial, would be great if I could put it to use if I won the raspberry Pi Giveaway!
Hi,
another really usefull tutorial. Thanks.
Chris
Would love to use the raspberry pi to help teach my daughter about electronics 🙂 Thanks for the chance!
I love coding projects and I was planning to upgrade myself from arduino uno to raspberry pi 3 but I was nt having any money left with me to do. I was planning to make a hacking machine by running Linux on it and also I will try my dream project JARVIS on it. Only because of Jarvis I am going for raspberry pi
3.5
I never stop getting impressed of what this little thingie can do. Great guide
Thanks for the tutorial i managed to install all on my pi together with other like sonar and couchpotato maybe on another video.
Nice job, thanks man.
Very nice tutorial, Thanks for sharing this stuff.
Very Detailed. Nice video and post.
Just great 😀
Awesome man i like your reviews keep goin in the same way its awesome
Just did this on a Pi2 B+ and it’s working like a champ. Excellent tutorial!
And if I win, I’ll probably build another RetroPie setup for my wife’s son so he can enjoy the awesomeness of the games I grew up on too.
Great tutorial! I have a Pi 2 I would prob’ly make into a torrent box if I ever get a Pi 3 so I could continue playing with Python.
As usual, another great tutorial bro! I cannot wait to try this out. !
Very nice tutorial!
Nice post, thanks!
Very good tutorial thank u sir
Great tutorial
Good tutorial
Nice post
Very nice video, very well explained !
I like the tutorial.
Interesting tutorial. I do not torrent at the moment but I may check it out in the future!
Awesome
To be honest, I don’t know yet what I would do with a Rasberry pi if I won one. It’s all quite new to me and it seems the possibilities are endless. It all looks very exciting though.
Time to make a useful home media server and IoT automation with RGB (just ordered some LED strips and planning to use the Pi as the primary controller) 😀
Excellent tutorial. Everything worked perfectly and network share connected with a Mac Mini without any issues. The only thing missing for the second version is a kill switch using UFW or similar for the times when the VPN goes down, so your IP is not exposed. Great job!
Hello!
First of all, thanks for this amazing tutorial.
I have one doubt. Everytime I boot the RPi and I open the deluge web interface, I’m prompted with the connection manager window.
If I don’t start deamon, the service is not running. So, even if the devices reboots, the service will not start without enabling it manually.
Please check the image:
https://imgur.com/a/7yyZv
Any tip?
Thanks
This page has the official methods of getting deluged to start with the OS: http://dev.deluge-torrent.org/wiki/UserGuide/Service
I have been running with the init.d method on my pi for years, though it requires a bit of tweaking from the steps provided.
I keep having to re do this every time the power goes out due the sd card corrupting is there a image file with all of this setup? Maybe such that the only variables are the PIA username and password?
You should take a backup image of your SD card once you get it running. You can use the same imaging software you used to setup Raspbian. On Windows, good recommendations are Win32DiskImager or Etcher.io
I’m having a problem where the VPN drops out over time, is there anyway to put a kill switch in?
Great article for going start to finish.
One other recommendation I would make is adding another user to [/home/pi/.config/deluge/auth]. This will allow you to connect in using a ThinClient (which may work better than the web client).
To do this:
1. Backup the current auth file: cp /home/pi/.config/deluge/auth /home/pi/.config/deluge/auth.old
2. Edit the auth file: nano /home/pi/.config/deluge/auth
3. Add a line in the bottom in the form of “user:password:level” where level is the permissions allowed. Setting to 10 allows full admin control. Example: pi:raspberry:10
4. To save this file, press Ctrl X then Y then Enter
5. Enable remote connections on deluge using: deluge-console config -s allow_remote True
6. Validate remote connections are allowed: deluge_console config allow_remote
Great thinking! Thanks for your letting the community here know and thanks for your awesome contribution.
Hello! I apologise for asking questions on an old article, but I am attempting to set one of these up at my university and I’m guessing there is an issue with the university firewall. I managed to get it working at my home, but now when I try to use [sudo openvpn –config ./”US Atlanta.ovpn” and sign in with my account there is a lag time and I am presented with a TLS Error stating that the TLS handshake failed. I apologise again for asking out of a place of ignorance, but is there something I can do to fix this issue?
I would suggest looking on your vpn site for some help with getting past firewalls; I know PIA has a lot of options and settings that can be changed to help get around that kind of thing. I have changed mine a few times from tcp to udp and changed ports as well because some firewalls have them blocked on purpose. Changing those settings within a pi may take a little more effort, but there should be other options in the config file that you can tell it to use.
Good luck
Great video and tutorial! I am in the process of creating this but I am using qbittorent instead because it has the built in torrent search engine. I will post later tonight when I am done if it all works out; that way you can search, download, and manage your torrents all from one web interface.
for autostart you do insert this line
sudo -u pi /usr/bin/python /usr/bin/deluged
sudo -u pi /usr/bin/python /usr/bin/deluge-web
Great video and tutorial; although I am getting the following warning message when I am starting the deluge-deamon:
/usr/lib/python2.7/dist-packages/deluge/_libtorrent.py:59: RuntimeWarning: to-Python converter for boost::shared_ptr already registered; second conversion method ignored.
import libtorrent as lt.
libtorrent version 1.1.1
deluge version 1.3.15
Great guide! Having a bit of trouble however…
For some reason Deluge won’t download anything though. Connection is fine, settings are fine, permissions are fine.
I’m guessing the culprit here is PIA though, since connecting to the VPN also requires to forward a port for traffic.
Any ideas on how to open a port on PIA’s end to allow traffic to the Pi through Deluge?
I liked your YouTube vid and tried that, but loads of issues with OPENVPN.
So I came here to try again and again but no luck.
It seems Pi 4 and Buster are not playing nicely.
I cant even get a password change to survive a reboot 🙁
If you wanted to help a fellow ranga out and do an updated for Pi 4 version that would be appreciated a hell of a lot.
thanks
It’s on the cards. Time is my biggest enemy right now. I will get a Raspberry Pi 4 Torrentbox tutorial completed in the next month or so.