Best Raspberry Pi Torrentbox Downloader With Deluge, Raspbian, OpenVPN, SAMBA Shares and USB HDD

Arrg, you don’t have to be a pirate now to run a Torrentbox, do ya? In this video I’m going to teach you how you can create your own, headless, Raspberry Pi Torrentbox And this includes everything, including setting up a VPN, setting up network shares and also setting up an USB Hard Drive What more could you want? Stick around, because it’s TechWizTime Hey guys,, Jonathan here with TechWizTime, where I teach you technologyy through tutorials In today’s video I’m gonna be teaching you how to set up your own Raspberry Pi Torrentbox Now there are plenty of tutorials out there on Youtube on setting up a Torrentbox using a Raspberry Pi, however, they don’t go into the details that this video is going into So one of the key differences with this tutorial is that I’ll be setting up a Hard Drive, so, an USB Hard Drive connected straight to the Raspberry Pi I’ll also be showing you how to set up OpenVPN, so you can set up your own VPN directly on the Raspberry Pi, so you don’t need to actually set it up network wide And, also setting up SAMBA Shares, so that way you can share the contents of the torrents that you’ve downloaded from the Hard Drive tot he rest of your network And one of the beauties of this is that it runs headless, so you don’t really need to hook this up to a monitor Everything can be controlled, after the initial setup, from any computer, in your home, on the same network Now, before we go any further, I just wanna ask you a favor, and that’s to share this video wherever you can across the internet, I’m talking Facebook groups, Reddit, etc. I realy want to get this video out to as many people as possible because it is what I believe to be the best way to set up a Torrentbox Share this video really does help out the channel, and, in advance, I just wanna say “Thank you” So, couple of things that you will need before we actually start this tutorial, you’ll need a Raspbery Pi, in my case I’m using a Raspberry Pi 1 because I just had it lying around and it doesn’t needs a lot of power So, I’ll start with the Raspberry Pi 1, The other thing that you will need is an USB Hard Drive, Now I’m using a 2TB Western Digital Hard Drive, and that’s doing the job for me Next you will need to hook it up with an USB Keyboard, and also to a Wired Ethernet Port And lastly, something that I completely forgot, you will need a MicroSD Card with the last version of Raspbian Lite written into it, so Make sure you got that all written to the MicroSD Card before we start this tutorial So, without further due, if you got all of those things, let’s jump over to the Raspberry Pi, and, we’ll look into setting this up right now So, before we even start this tutorial, one of the things that you’ll want to have done is to install Raspbian Lite onto a MicroSD Card, now the reason why we’re going with Raspbian Lite here Is because it is a long live operating system, so, it doesn’t has a lot of overheads So to log into your Raspbian Lite installation you just need to use the username “pi” , and the password “raspberry” So once you’ve logged in, the first thing that you’re going to want to do is do a quick update, so to do that we type in “sudo apt update” This make take a little while, so please be patient, but once that’s done, the next thing that we’ll want to do is type in “sudo apt upgrade” This will definetively take a lot longer than the update process, so, bear with it and eventually it will finish So, now that we finished upgrading our Raspbian installation, the next thing that we’re going to want to do is to change our password And to do this we just type in “sudo passwd”, we need to type in a new password, and then we need to re-enter that new password again, and then it will be changed. So, make sure you keep record of this password that you just changed to Now the next step is we’re going to install OpenVPN, so to do that we type in “sudo apt-get install openvpn -y”, now the reason what I’ve put a “-y” after is so it automatically says “Yes” to continue So, after a little bit, that will come back, and it will finish installing OpenVPN So, the next step is we’re going to change our directory to the OpenVPN directory, and to do that we type in “cd /etc/openvpn” Okay, so, now what we’re going to do is we’re going to download the OpenVPN configuration files directly from Private Internet Access Now, that’s my VPN of choice, I’ve actually used them for 5 years, purely because their service is excellent and their VPNs are not logged So if you’d like to check them out, I let a link down in the description below So, to download the openVPN profiles, all we need to do is type in “sudo wget” And once that’s done, we’ll unzip that file, so to do that we type in “sudo unzip” This will extract all the profiles to the OpenVPN directory, so, take note off all these names here, depending on what VPN you want to connect to, we’ll depend on the name that you need to choose here So to test if this is going to work or not, I’m going to try with the Netherlands VPN, so type in “sudo openvpn –config ./Netherlands.ovpn” Now, Netherlands needs to have a capital “N”, so, make sure you do that And what should pop up is a request for your username and password, so type those in here, and it should go to “Initialization sequece: Completed” This means that there wasn’t any problems, so, to terminate this we’ll just press “Ctrl C” on the keyboard So now that we’ve found out that it’s working correctly, what we’re going to do is we’re going to set up a configuration file So you don’t have to type in your username and password all the time, so to do that, we just type in “sudo nano login.conf” Now this will create a new document, so, what we’ll do is we’ll type in our username on the first line, and our password on the second line, and then to save this document we just press “Ctrl X”, “Y” and “Enter” And, just as an extra safety precaution, what we’ll do is we’ll change the modification rights for this file, and to do that we type in “sudo chmod 400 login.conf” Now the particular VPN that I’m going to connect to in this tutorial is going to be Singapore So, what we’ll do is we’ll copy the OVPN file and create it as a “.conf” file, where we can change a few of the settings, so to do that, we just type in “sudo cp Singapore.ovpn Singapore.conf” And the next step is to edit that “.conf” file, so we type in “sudo nano Singapore.conf” In this text file what we’ll need to do is we need to go down to “auth-user-pass” section, and after that we’ll type in “/etc/openvpn/login.conf” So this is redirecting the username and password to grab it from this file, and just to be safe, what we’ll do is we’ll go down to the “crl” and the “ca” section down the bottom, and we’ll specify the “/etc/openvpn/” directory structure Now that we’ve done all that, we press “Ctrl X”, “Y” and “Enter” to save that file And the next step is, is we will test it, to make sure that OpenVPN works with that configuration file, so to do that, we type in “sudo openvpn Singapore.conf” And if everything went Ok, then it should say “Initializing sequence: Completed” So, if you get to that, all you need to do is press “Ctrl C” on the keyboard to interrupt that, and we’ll be back at the prompt So the next thing that we’re going to want to do is we’re going to want to make OpenVPN start everytime the Raspberry Pi boots up So to do that, we type in “sudo nano /etc/default/openvpn” And what we’ll need to do in this file is we need to fo down to just after the last “AUTOSTART”, create a new line there, and we’ll type in capital letters “AUTOSTART=”Singapore”” Now if you’re in the US, and you press the quotation marks and it comes up with an “@” symbol, what you can use for now, until we go and change it, is the “@” symbol up on number 2, so “Shift 2” should give you the quotation marks So once you’re done with that, you need to press “Ctrl X”, “Y” and “Enter” to save that file So now that we’ve done that, what we’ll do is we’ll give the Raspberry Pi a quick reboot, in my case here I’m using “sudo shutdown -r 0” And once it comes back, login with your Raspberry Pi username and password, the one that we set before, the username still “pi” And what we’ll do is we’ll quickly just check and see whether or not we are using OpenVPN right now, and to do that, if you already know what your IP Address is, you can compare it to this one here, so we’ll type in “curl” Now I know that particular IP Address is definetively not mine, so, it is connected by OpenVPN to the Singapore VPN using PIA. Awesome! Okay, so, now we’ve got OpenVPN set up using PIA, which is called “Private Internet Access” PIA is actually one of the VPN Providers that I’ve been with for about 5 years now, and I highly reccomend it, so, if you do wanna check them out, you can check the link in the description below But now that we’ve set up OpenVPN, the next step will be to set up the USB Hard Drive, so lets pop over to the Pi and we’ll go from there So obviously make sure that your Hard Drive is attached And, also make sure that you got your USB keyboard still attached as well But, don’t attach any USB Sticks or anything like that because it’ll just confuse things So, all you need to do once you’ve plugged that in and it’s all up and running, let’s type in “sudo parted /dev/sda” And we can quickly just check on the partitions here by pressing “P” on the keyboard I previously wiped mine so it is ready to go, so all I need to do now is type in “mktable msdos” Make sure you’ve got nothing on here that can be lost, make sure it’s a fresh one ready to go and then just say “Yes” to continue The next thing we’re gonna do is set up the partition so we put in “mkpart primary ext4 0% 100%” So, it will make the whole Hard Drive Linux compatible Once you’ve done that, you can press “P” to see if it’s done it correctly type the whole thing, which is “print” I can see that the partition is in there correctly so, now I just put in “quit” and it’s exiting the “Parted” program So the enxt thing we’ll type in is “sudo mkfs.ext4 /dev/sda1” If it does ask you, just press “Y” to continue, and if everything went correctly, then it should come back saying “Done” Okay, so we prepared the Hard Drive, now what we’re going to do is we’re going to create a mount point for the Hard Drive inside the Raspberry Pi, so to do that we type in “sudo mkdir /mnt/torrents” And we’re going to quickly mount it to check that it works so “sudo mount /dev/sda1 /mnt/torrents” Now to check if that’s worked correctly, what we’ll do is we’ll type in “df -h”, and if we have a look down the bottom there, I can see that dev/sda1 is correctly mounted to that Torrents folder Awesome! But, not so quickly, what we want to do is we want to set it up so that way every time it reboots it automatically mounts the /dev/sda1 partition to that Torrents folder So to do that, we type in “sudo nano /etc/fstab” So, in this text file, down the bottom, after the last “/dev” entry, we’ll create a new line in there, and we’ll type out “/dev/sda1 /mnt/torrents ext4 defaults 0 0”, so What you’ll need to do is you’ll need to make sure that you use Tab and spaces aswell and try to line it up, just so it’s nice and neat, and you’ll know, next time what the settings were So this is just basically to tell the Raspberry Pi Linux-based Operating System everytime you boot up, you also want to mount the external Hard Drive to that torrents folder Once you’ve done it, all you need to do is press “Ctrl X”, “Y” and “Enter” and the “fstab” file will be saved So now what we’ll do is we’ll do a quick reboot, and to do that we’ll type in “sudo reboot” Again, this is just another way of rebooting the Raspberry Pi And once we’re back up and running, what we’ll do is we’ll login again, and we’ll quickly check and see whether that has mounted automatically, and to do that we’ll type in “df -h” And down the bottom there I can see that the /dev/sda1 partition has been mounted correctly Awesome! Okay, so, now we’ve got the Raspberry Pi setup with the USB Hard Drive, and it’s all ready to go, it’s automatically gonna start up everytime we boot the Pi So, there’s nothing more we can do with the USB Hard Drive So, the next step is to set up the Torrent program, or Torrent client And, in this case, I’ve chosen to go with Deluge Now the reason I’ve chosen Deluge is because of it’s compatibility with a lot of torrent places out there, as well as the ability to use Add-ons So, whe’re not gonna explore that in this tutorial, however, it is something that you can look into for yourself after you finish setting it up So, let’s jump back over to the Raspberry Pi, and we will set up Deluge So now we’re going to install Deluge on the Raspberry Pi, and to do that what we’ll do is we’ll type in “sudo apt install deluged -y” This will wake a little bit as it gotta download a few files to set this all up, but once it is done, the next step is to set up the web client, and to do that we type in “sudo service deluge-web -y” Okay, so now that we’ve got the two programs installed the next step is we’re going to be setting up some folders on the USB Hard Drive, so to do that, we type in “cd /mnt/torrents” Once we’re inside that directory what we’ll do is we’ll start creating some directories, so we’ll type in “sudo mkdir downloading” This will be where we keep files that are currently downloading, next we’ll do “sudo mkdir completed” This is where the completed files go Then we’ll type in “sudo mkdir watch” Now, this will be important at the very end if you stick with it, where you can drag and drop files through SAMBA, so it automatically starts in Deluge And lastly, “sudo mkdir backups” Now this will be where any of the Torrents you download are backed up to, just in case you need to go back there and re-downlaod it And we can check that those are all correctly int here, so we’ll type in “ls -la” And this will give us a list, and we can see all of our folders are there and ready to go So the next important thing is to get the IP Address of the Raspberry Pi, and to do that we’ll just type in “ifconfig” And I can see up there in “ITH: 0” my IP Address, so that’s the one that I’ll use, and it should be in the same or similar place for yours But before we can go to the computer, we’ll have to start Deluge itself, so to do that, we type in “sudo service deluged start” Now that’s the base program, but we’ll also need to start the Web Client, so to do that, we just type in “deluge-web” Now this will just sit there and won’t come back to a prompt, so, what we’ll do is we’ll pop over tot he computer now and we’ll see how this actually logs in and what we’ll need on that side So to log into the Deluge Web Client what we need to do is we need to type in the IP Address from before with “:8112” Now it should prompt you for a password, and the password is “deluge” So it should come up to the connection manager here and what we need to do is we need to click on the IP Address that we see there And if the Daemon isn’t startedyet, we need to click on “Start Daemon”, and then hit connect Now I’ve got into the “Preferences” section here and under “Interface”, I’m going to change the password from default, which was “deluge”, and then type in a new password Then all I need to do is hit “Change” Now go to the “Download” section on the left hand side, inside “Preferences” still, and here we’ll type in the folders that we’ve created, so, the first one is “/mnt/torrents/downloading/” Next we’ll put a tick in the side of “Move Completed To” and we’ll type in “/mnt/torrents/completed/” Besides “Autoadd .torrent files from”, we’ll put a tick in there, and we’ll put the directory in as “/mnt/torrents/watch” And lastly where is “Copy of .torrent files to”, we’ll put a tick in there and we’ll put the directory in “/mnt/torrents/backups”, and then we’ll just click on apply You can get to the other preferences here and change them as you need to, but this is basically what you’ll need to get started, so The next step is we’re going to add a torrent, so to do that, up the top we click on the add button And we also click on the “URL” because we’re gonna paste the url in here, and in this case I’m gonna go over to the Raspberry Pi website, and I’m going to download the latest Raspbian So, copy the torrent link there, and I’ll go back to Deluge and I’ll paste it in the url section So we just wait for a moment and that should come up with the Raspbian “.zip” file, and then what we can do is we can just click on the “Add” button Now you’ll notice here things are changing, starting to download, but then all of a sudden, Error, now hopefully you haven’t bailed on this video yet because, this is something important that we’ll need to change on the Raspberry Pi to get it to work At the moment, the permissions are a problem, so let’s jump back over to the Raspbery Pi and we’ll fix that now So, back on the Raspberry Pi now, what we’ll need to do is we’ll need to press “Ctrl C” to interrumpt this program And, what we’ll do now is we’ll type in “sudo chwon -R pi:pi /mnt/torrents/” This will change the ownership recursively for that torrent folder, so that way the user “pi” owns those folders Now to check that whis worked correctly, what we’ll do is we’ll type in “ls -la /mnt/torrents/” And here you can see that the username, and the usergroup are both “pi” running down there, so let’s start “deluge-web” again, and we’ll jump back to the computer and see if this works So, connect it through the web client again, and this time what we’ll do is we’ll add that Raspbian url again through the “Add” button at the top And, you’ll see now that it actually stars up, and, I’m gonna fast forward here, but you can see that the whole thing downlaods without a problem now that we’ve set up those permissions Now, in the last step of this tutorial, which is the SAMBA Shares, it does get a little bit tricky if you’re using a UK based keyboard layout with an US computer, so What we’re going to do here quickly is we’re going to change a few things, so that way your keyboard will work if you’re based on the US So we’ll type in “sude raspi-config” And this will start up the Raspberry Pi Configuration Tool One of the things that I’m going to do with this particular setup is I’m gonna change the host name To something other than “raspberry-pi” So, in this case, I’m going to “Host Name” and I’ll change that To “deluge” This will allow me to log in via a web browser to “deluge.local:8112”, instead of the IP Address You don’t have to do this, but if you do like it to be a little bit more clean, then this is how you do that So, next step we’ll go down to “Localization”, and tehn we’ll go to “Keyboard Layout” We’ll keep it on the “Default English 105 Key” keyboard, but we’ll go into that, and, we’ll go down the bottom and choose “Other” instead of “English (UK)” We’ll go down and choose “English (US)” or whichever other language you want to choose And tehn we’ll go up the top and choose “English (US)”, we can click “OK” through the other settings here But once you can go back you can go back into localization and go into “Change timezone”, and here, I’m in Australia, Sydney, so I’ll just change that to Australia and then Sydney And one other thing that you could do is you could remove the “Overscan”, I’m just doing that here because every now and then I will login into the Raspberry Pi instead of SSH-ing into it And because I’m going to be running this headless, it doesn’t needs a lot of GPU memory, so, we’ll change that from 64 down to 16, this just gives me a bit more memory to play with Specially consedering I’m only using a Raspberry Pi 1 here, once you’re down, you can narrow accros the “Finish”, and this will let you know that you need to reboot, so do that now To start Deluge automatically everytime the Raspberry Pi reboots We need to change something in the “rc.local” file, so to do that, we type in “sudo nano /etc/rc.local” Go down to the bottom of the file here and create a few extra lines and we’re going to create two things here, this is a little script that will actually tell you what your IP Address is at the Command Prompt whenever you reboot So, follow this code on the screen now, again, you can skip this if you like, but the second thing that we need to do is we need to start up both Deluge and the Deluge Web Client everytime it reboots, so to do that We type in the line “sudo -u pi /usr/bin/python /usr/bin/deluge-web &” Now the reason for the “&” symbol is because when you’re booting, if you don’t include the “&”, it won’t actually proceed to the login screen, it will just stay there in a loop So by putting the “&” symbol there, it will run that line of code, as a separate process So, finally after you’ve done that, you need to type in, as a new line “exit 0”, you need to save that by pressing “Ctrl X”, “Y” and “Enter” And then we’ll do a quick reboot with “sudo reboot”, and if you ddi typed the little script there to show your IP Address, you will see, on the screen there, “connected to deluge using:” and then your IP Address So this is just handy for anyone that wants to keep track of how to login in, just in case they forget Awesome! Now that we have Deluge set up, it’s all up and running, there were a couple little hitches there, but I showed you how to overcome them And now the last thing that we want to do is we want to set it up so we can access the Raspberry Pi via the network So, one more time, let’s jump over to the Raspberry Pi and we’ll set up SAMBA Shares so we can access any of the torrents or even drag and drop torrents into the watch folder So the last thing that we’re going to do here in this tutorial is we’re going to set up SAMBA Shares or Network Shares for Windows and other Operating Systems So to do that we need to type in “sudo nano /etc/samba/smb.conf” Inside this file, we need to go down to “win support” and take out the “#” and then change that from “no” to “yes” Then we need to go right down to the very bottom of the file and create a new line there, and we’re going to set up the SAMBA Share information here So, I won’t read this aloud but what I’ll do is I’ll explain what each line is doing, the first line there with the “[]” is just giving the Share a name, and that’s torrents all in capital letters The second part, the comment is giving it an actual name itself, so that’s Torrents, the path is the Share that we’re going to enable, and in this case it is “/mnt/torrents” Create mask and directory mask is set at 0755, that way we have writte and read access to it Read only is set to “no” so we can write to it and “broseable” is set to “yes”, “public” is “yes” and “force user” is “pi” As that’s the Raspberry Pi username that we’ll be login into the SAMBA Share with And lastly “only guest=no” So once you’ve done with this, press “Ctrl X” “Y” and “Enter” And now we’ll just give it a quick reboot with “sudo reboot” Now, just quick, if it doesn’t works on the computer, come back to this section here because what you can type in is “sudo apt install samba samba-common-bin -y” This is just in case it’s missing anything that it requires, and of course after this you do a quick “sudo reboot” So, let’s jump over to the computer now, and we’ll just check how you can log in to the Network Share So, over on the computer now what you’ll do is you’ll type into the address bar if you’re on a Wndows computer “\YOURHOSTNAME” or “\YOURIPADDRESS” And it should come up asking for username and password, this is your Pi usename as well as your Pi password that you might have changed to If you left it as default it should just be “raspberry” as the password Now it should load up to the torrents folder, so if you double click into there, you’ll see all the folders that we created before And because I’ve downloaded Raspbian through the Deluge client before, I can go into the “completed” folder and see that file already there So now I can copy this to my computer from the Raspberry Pi itself, and lastly, you can see down the bottom there the “watch” folder, which, if I was to go into that and drag a torrent file into it It will automatically start up in the Deluge Web Client How awesome is that! Okay, I know it was a long tutorial but, we got there in the end, and now, you’ve got a Raspberry Pi Torrentbox That is set up with a VPN It’s also set up with the USB Hard Drive It’s also set up with the Deluge torrent client And SAMBA Network Shares As well as a watch folder that whenever you drop a torrent file in there It will automatically start downloading it How awesome is that! Okay, so, in general, if you did enjoyed this video and you’re not a subscriber already then make sure you do Tehere’s a little red button there, you need to clcik on that And if you are already as subscriber then make sure you hit that bell icon down there so you get notified whenever I release new videos Don’t forget to like this video and also leave me a comment down below if you think there’s something I could have done differently And as always, Imagine, Learn, Create

Leave a Reply

Your email address will not be published. Required fields are marked *