How to Build a Low Cost OpenVPN Server using Debian 9

Hello everyone, welcome to my Linux Tutorial website. In this article, we are going to learn how to build a free OpenVPN Server using Debian 9. If you need a VPN to support your work or your internet activity, you may consider commercial VPN providers. There are many good VPN providers out there but here, I want to share my experience when building my own OpenVPN Server using Debian 9.

Well, actually it is not 100% free because you will need cloud computing such as Amazon EC2, Linode or Digital Ocean Droplet. You don’t need a high server specification in order to power up an OpenVPN server. In this example, I am using the smallest Linode cloud computing called Nanode (1GB RAM and 20GB SSD). It cost me about USD 5 per month. I also use this cloud server to serve my websites. So it is not dedicated to OpenVPN only.

There are benefits of using this custom build OpenVPN Server compared to a commercial one.

  1. We have unlimited access to the VPN server
  2. Easy to install and manage
  3. Low cost

So there are few steps we need to do to build our own OpenVPN Server.

  1. Create a new cloud computer. I suggest you to pick one from a well known provider such as Google, Amazon AWS, Digital Ocean or Linode. To start an instance using Linode, use this link.
  2. Install and configure OpenVPN Server
  3. Install OpenVPN client on our local PC
  4. Start using OpenVPN

Step 1. Run a new cloud computer instance

Like we mentioned before, you are free to choose a low cost cloud computer instance from Amazon AWS Lightsail (Start from $3.5 per month), Digital Ocean droplet (starts from $5 per month), Linode (Starts from $5 per month).

Please read this article to find out how to spin up a new Linode server instance within a minute. Make sure you choose Debian as your server operating system. After that, you should now have access to your server via SSH.

Step 2. Install and Configure OpenVPN Server

I assume now you have a running server instance and you can connect to it via SSH. If you are running Windows, you can use Termius or Putty to connect to your cloud instance.

ssh root@your-server-ip-address

Change your-server-ip-address with your actual cloud server IP address. Enter your root password and you are good to go. Next, let’s download the OpenVPN installation script. This script will help us to automatically install OpenVPN server and configure everything for us.

wget https://git.io/vpn -O openvpn-install.sh

Next, execute the script with this command

bash openvpn-install.sh

Answer some questions shown on your Terminal screen

After that, you will find a new file (.ovpn) under your /root/ directory. This is the configuration file we need to connect to this OpenVPN Server from the client computer. You need to download this file to your local computer. Usually, I use WinSCP to do this.

How to Connect to OpenVPN Server

From Windows 10

First, download and install OpenVPN for Windows 10. Next, copy or download the .ovpn file we created on the previous step. Put the .ovpn file inside C:\Users\your-username\OpenVPN\config. Done. You can now connect to the OpenVPN server

From Linux Desktop

You can connect to the OpenVPN Server from any Linux distribution. In the following example, I am using Manjaro Linux.

Open Settings >> Network. Click + button close to the VPN area.

Next, click Import from file and navigate to the .ovpn file.

Now you should see the openvpn server details

Click Add to complete the step.

From Android device

Download and install OpenVPN from the Google Play Store. You will also need the .ovpn file copied to your Android device. Open OpenVPN and select the .ovpn file.

From iOS device

Download and install OpenVPN Connect. Select Import from file and then follow the steps until completed.

Now you can enjoy unlimited VPN connection from any devices with a single OpenVPN Server. Thank you for reading this article, I hope you enjoy it and see you.

Be the first to comment

Leave a Reply