 Hi I'm Denchi and in today's video I'm going to show you how to set up your very own Pi VPN server on a Debian server. Now Pi VPN only works on Debian, Raspbian and Ubuntu. So don't attempt to do this on Arch Linux or other such distributions. Before beginning with this tutorial though, there is one important step to note. If you are under an NAT, so if you're personally hosting your stuff and it's under a router, you need to add a port forward that port forwards the UDP protocol at a specific port. It can be pretty much any port. So I'm going to show you an example. So I'm just going to make an active connection. I'm going to call it VPN and I want to make sure that the port is something like I don't know 2020 or something. It can be anything but just as long as it's not used up by something else in the system. The server IP address in my case is 192.168.1179. And the protocol, this is the most important part has to be set to UDP. Now that's done, we can move on to Pi VPN. All right, to set up Pi VPN, we first want to just copy this command over here to CURL the script and send it over to bash. So just run that over there. It may ask for your sudo password. So if it asks for that, just type it in and press enter. Soon it's going to install packages and stuff. And then it's going to open the interface, the Pi VPN automated installer. The first thing it will warn you about is you need a static IP and by default, this pretty much should work on Debian, but it is different settings for each router. And I really can't go through all that if you're stuck at this, just make sure that restarting your server behind whatever router you're using doesn't change the local IP address of it. Because if that happens, then that would screw up the ports. But for most people, this shouldn't really be an issue. All right, so I go into the local users section to select any one of these users. In my case, I'm just going to pick Alex to be the guy who actually manages all the VPNs. Now this is the most important decision of all, you get a pick between two different VPN protocols, either open VPN or wire guard. Now wire guard is more secure and newer and more minimalist. In fact, wire guard is actually a Linux kernel module, which means you don't need any extra software to use it. You do, however, do need some extra software to interface with it, which we'll talk about later. Open VPN, on the other hand, has a few advantages over wire guard, despite being much more bloated and a little bit more antiquated. While open VPN does require a special client's software, it is generally better for privacy, at least on the server side, because open VPN gives different IPs to each user who uses the VPN servers. And it also can be configured to log everything to nothing. So you can log to dev null, so delete all the VPN logs, which makes sure that no data is left on your server. Because this is a personal server, though this isn't really an issue, and wire guard is a perfectly adequate option. So I'm going to go with that. Now this is the important part, you got to set the port. In my case, as I said, I'm going to set it to 2020, just make sure this is the same port as the UDP port, which you forwarded on your router. And if you're under like a VPS or something, then you can basically pick anything here. Okay, now it's going to ask for DNS provider, you can just go with the default, and the DNS entry, this can also be default, and the server keys will now be generated. All right, if now I'm going to ask about unattended upgrades, you can basically just say yes to this, if you want to make sure your packages stay update for security reasons, but I'm commonly on my server. So I don't think this really will be an issue for me. All right, the installation is now complete. And we get a little guide on how to actually use Pi VPN with the Pi VPN add command or Pi VPN dash a, it's going to ask to reboot, we don't really need to reboot because as I said, wire guard is a kernel module. However, if wire guard is giving you some issues, just reboot your system and then it might work. All right, so now that that's all set up, we can use the Pi VPN command, as you can see, it's got all the options there. So how do we actually connect to it? Well, first of all, we have to create a user profile for us. So I'm just going to do Pi VPN dash a, so that's for add dash n, which is for name, and I'm going to name myself Alex. And as you can see, it generated a configuration file. So Alex.com gets generated in the following directory config. So if you list the configs directory, there's a file called Alex.com. And that's my wire guard configuration. So now we're going to transfer that over to my local machine over here is my little Linux laptop. And we're going to connect to the VPN from here. And we're going to see if our IP address, which is listed over here on doc.go in Dubai, changes to the one of this server. So I'm using a file transfer tool called filezilla. If you want to use something else, then sure use that like scp or rsync, but I find this to be the most convenient method. I'm going to go into my configs directory, which you just talked about over there. It's in your home directory. So in my case, home Alex configs and copy over the configuration file to my desktop. As you can see, I already have one from previously connecting. I'm just going to overwrite this just press okay. And everything is fine. It transferred perfectly well. Now I'm going to open a terminal on my local machine. So not SSH. And I'm going to go into my desktop directory or just anywhere where I actually have the configuration to actually interface with wire guard, which once again is a kernel module. There's no daemons. There's nothing complex. You got to install the wire guard tools package. So in my case, that's yay dash s wire guard tools like that. I already have this install so I don't need it. So to actually connect with that configuration file, we copy it over, you want to run sudo wg quick up and then dot slash your configuration file. So in my case, Alex.com. So I run that. And as you can see, it's giving me no errors. If it gives you an error related to resolve comp, then you have to install the open resolve package, which on Arch Linux is open resolve like that. So I've already got that installed. It didn't give me an errors. But if it's giving you an error that says like resolve comp, that's the package you got installed and then run the command again. So now that I've done that, let's see if my IP address changes when I reload the page. As you can see, my IP address is no longer in Dubai. It's now in Rome, Italy, which is the location of this server. So we've successfully set up our wire guard self hosted VPN using PI VPN. I hope you enjoyed this video. But before I end just a note on VPN usage and your responsibility of VPN is not a magical shield for you to perform illegal activities, you are still 100% subject of persecution. If you do anything illegal, whether using a VPN or not. So please be responsible and don't do anything bad with these sort of tools. The reason you use a VPN is to protect your privacy and your anonymity online. Using a VPN in combination with the Tor browser is quite simply the single most anonymous way to browse the internet. And if it's self hosted like this one, then you've essentially found yourself an incredibly easy way to secure your actions on the web. So I hope you enjoyed this video of myself hosting tutorial series. I've been Denchie goodbye.