๐Ÿ“ŽHow to install a VPN? (On a VPS)

For a VPN, you can use different software. In this tutorial, we will install WireGuard and OpenVPN!

What is a VPN?

A VPN is a secure tunnel on the Internet that encrypts your Internet traffic and protects your online privacy. It ensures that no one else can see what you are doing on the Internet and where you are. For example, you can safely use public Wi-Fi networks and bypass geographical restrictions to access content that would otherwise be unavailable. It also makes your own IP address unavailable.


What is the difference between WireGuard and OpenVPN?

WireGuard is faster, more secure and easier to configure than OpenVPN, but has less support because it is a relatively new technology. WireGuard and OpenVPN are both secure for setting up VPN connections. But because WireGuard uses newer cryptographic technologies, it is generally considered more secure.

Go to the WireGuard installation.

Go to the OpenVPN installation.


WireGuard installation

Make sure your VPS has the latest packages. This can be done with: sudo apt update && sudo apt upgrade

  1. Download the installation script from github. This can be done with the following command: curl -O https://raw.githubusercontent.com/angristan/wireguard-install/master/wireguard-install.sh

  2. Make sure the file is executable. This can be done with the following command: chmod +x wireguard-install.sh

  3. Now start the installation. This can be done with the following command: ./wireguard-install.sh

  4. Once you have started the installation you will be given a number of options, take over the following

IPv4 or IPv6 public address: <IP addresses of your VPS>
Public interface: <press enter>
WireGuard interface name: <press enter>
Server WireGuard IPv4: <press enter>
Server WireGuard IPv6: <press enter>
Server WireGuard port [1-65535]: 51820
First DNS resolver for clients: 8.8.8.8
Second client DNS resolver (optional): 8.8.4.4
Allow IPs in the list for generator clients (by default allow everything to be routed): <press enter>
<Press enter>
Client name: <Example: desktop>
Client WireGuard IPv4: <press enter>
Client WireGuard IPv6: <press enter>

Now the installation is complete. To copy the credentials you run the following command: cat wg0-client-<client name>.conf . You will get a number of lines of text. Copy this and paste it into your WireGuard.

  1. Once you have downloaded and opened WireGuard press ctrl + N and paste the text you just copied from SSH. At 'Name' you can enter your own name.

  2. Now press "Save" and then "Activate.

Now you have managed to install a WireGuard VPN on your VPS and connect with it on your PC/Laptop.


OpenVPN installation

Make sure your VPS has the latest packages. This can be done with: sudo apt update && sudo apt upgrade

  1. Download the installation script from github. This can be done with the following command: curl -O https://raw.githubusercontent.com/angristan/openvpn-install/master/openvpn-install.sh

  2. Make sure the file is executable. This can be done with the following command: chmod +x openvpn-install.s

  3. Now start the installation. This can be done with the following command: ./openvpn-install.sh

  4. Once you have started the installation you will be given a number of options, take over the following

IP address: <press enter>
Do you want to enable IPv6 support (NAT)? [y/n]: n <press enter>

Which port do you want OpenVPN to listen to?
   1) Default: 1194
   2) Custom
   3) Random [49152-65535].
Port selection [1-3]: 1

What protocol do you want OpenVPN to use?
UDP is faster. Unless it is not available, you should not use TCP.
   1) UDP
   2) TCP
Protocol [1-2]: 1

Which DNS resolvers do you want to use with the VPN?
DNS [1-12]: 3

Do you want to use compression? This is not recommended because the VORACLE attack uses it.

Enable compression? [y/n]: n

Adjust encryption settings? [y/n]: n

Specify a name for the client.
Client name: (Can you think of your own).

Do you want to password protect the configuration file?
   1) Add a client without a password
   2) Use a password for the client
Select an option [1-2]: 1

Congrats the installation of OpenVPN is complete and you have created a user.

Download the latest OpenVPN version at https://openvpn.net/community-downloads/

  1. Download the OpenVPN profile from your VPS. To do this you must connect to the SFTP of your VPS. If you do not know how to do this we have a tutorial here: How do I open a sftp session to a vps?

  2. Find the config file on your PC and drag it into your OpenVPN config folder. Often, this is C:\Program Files\OpenVPN\config .

  3. Once this is done press the small arrow at the bottom right (Windows Arrow beside your language settings on the navigation bar), then OpenVPN and then connect.

  4. See if your IP address has really changed at https://www.watismijnip.nl/

Now you have succeeded in installing an OpenVPN on your VPS and using it to connect on your PC/Laptop.

Last updated