Create your own personal Secure VPN on the Cloud

article-featured-image

This article is about creating a secure personal VPN. Nowadays with all those privacy concerns and restrictions over freedom of speech, using a VPN is essential for almost everybody. When it comes to Selecting the right VPN provider, that privacy issue arises again. In simple words, you cannot even rely upon VPN providers for your data safety.

Why Personal VPN ?

You might select a VPN provider after so much investigation and research, but the next thing you find out is your Internet history is being sold to some Data collection agency. The probability of happing this thing is much greater nowadays.

However, there are some really good VPN providers that really took their work more seriously. They usually provide their services from where the laws make it almost impossible for your data to be revealed to any third party and also from a security perspective, they are great. Are they costly? YES, very much. So we are back again creating our own secure VPN. A VPN that you will control and manage yourself, you will govern your internet history and data.

Benefits of using a personal VPN:
  • No Speed drop: Unlike almost all free VPNs, using a personal VPN does not impose any speed barriers. If you select the server location carefully, you won't even see the difference in speed.
  • Enhanced Security: VPN encrypts your internet traffic. Your traffic will be protected from hackers, network sniffers, or even the government unless you do something that you are not supposed to do.
  • Privacy Control: VPN let you control your online privacy. Your real public ip will be masked using VPN which will protect your online presence from websites you visit or your ISP.
  • Access Region Restricted Content: You can access the content that is restricted by geo-location while maintaining online anonymity.
Apart from these, there are much more benefits of using a VPN. It all depends upon how to use it.

Create Linux Server in the Cloud

The first thing you need is a server. For that, there is no better place than Cloud. There are many cloud providers in the market. Below is the list of some recognized and trusted Cloud providers:

  • AWS - Amazon Web Services
  • Linode - Cloud Computing Services by Akamai
  • GCP - Google Cloud Platform
  • OCI - Oracle Cloud Infrastructure

All of these Cloud providers have Free Tier plan available. You can choose anyone for this project. But if you have any other cloud provider in mind, you are good to use their services.

  • After creating an account with cloud provider, you will need to launch a server. If you are a little bit serious about it, choose a server with at least 1GB of ram. Your VPN speed will depend upon the server region you choose. So, don't go too far.
  • Server operating system must be Linux. You can select any distribution from this list: Ubuntu, CentOS, Alpine, Redhat (RHEL), Linux Mint, PopOS, Rocky, Kali, Arch Linux, OpenSUSE (leap, tumbleweed, sles), Fedora, Amazon Linux
  • Make sure to update the server. Command the update server might be different for distribution.

VPN Setup in the Cloud Server

As you might have guessed, creating or setting up your own VPN is little complex task, or even more if you are a non-technical person. So to make things easier, I've written a Bash Script that will make it easier to set up VPN for anybody. This script will work on all linux distributions mentioned above. Get the script from my GitHub repository: Get OpenVPN or you can simply clone it using the command below, make sure you installed Git for cloning:

$
git clone https://github.com/pbxforce/openvpn-Install.git

After cloning or downloading the ZIP package from GitHub, use the below command to run the main script. Make sure you run the script with sudo privileges.

$
sudo bash install-vpn.sh

Script will do all the heavy lifting. Throughout the script running process, you will be asked for some choices as described below:

  • Select Protocol: Type either TCP or UDP, prefered is UDP
  • Specify Port: Press ENTER to use default 1194 port OR you can specify your own port. Make sure your custom-defined port is above 1000 and is not already being used by another service. You may need to allow the port in your cloud firewall
  • Primary DNS server: Press ENTER to use default primary DNS server OR you can specify your own DNS address. You can use 8.8.8.8 for google DNS server
  • Secondary DNS server: Press ENTER to use default secondary DNS server OR you can specify your own DNS address. You can use 8.8.4.4 for Google DNS server.
  • Choose VPN Client name: Pick name for your VPN client.
  • Server's IP Address: Enter your server's public IP address. You can get the IP address from the cloud dashboard.
After completing all the steps, you'll get the same message as in the image below: vpn-success-message

If you got this message, it means your VPN setup is successful and it is ready to use. You can find the VPN client file in your current working directory(which is 'openvpn-Install' if you haven't renamed it already).

Connecting to VPN

Now that you have set up your own VPN in the Cloud. The next part is to connect to it. And the process of connecting to VPN depends on the operating systems you are using.

  • For windows: Download and Install Openvpn Client Connect. Launch 'OpenVPN Client Connect' application and import your VPN client file. After importing, you will be able to connect to your VPN.
  • For Linux: There are two ways to connect to VPN on Linux: GUI and CLI. If you are using Linux with KDE or GNOME desktop environment, then you'll have OpenVPN plugin in your system.
  • GUI: Go to System Settings and open Network Connections where you can Add new connection. Choose Import from file option and select the ovpn file. add-vpn-connection In the image above, I'm using Linux Mint. You might have different user interface depending upon your distribution.
  • CLI: First rename your VPN client file from .ovpn to .conf (ex: client.ovpn > client.conf). Install openvpn package in the system using sudo apt install openvpn command. Then run sudo openvpn --config /path/to/client.conf command to connect to your VPN.

After connecting to VPN, visit What is my IP to check your IP address. You will see the IP address of your VPN server, which means all your internet traffic is going through your VPN.

Setting up Personal VPN on Cloud
protocolten-admin

Author: Harpreet Singh

Created: Sat 22 Apr 2023

Updated: 2 months, 3 weeks ago

POST CATEGORY
  1. Linux
  2. Cloud
  3. Scripts
Suggested Posts:
CLOUD post image
Create IAM user policy for single S3 bucket access

Are you looking to grant specific access to an AWS S3 bucket for an IAM …

LINUX post image
Install Latest Version of PHP on CentOS 8 and 7


CentOS is great. I have to admit that all those SELinux enforcement and other …

LINUX post image
Install LAMP on Ubuntu or CentOS with firewall configuration

This tutorial will be focused on installing the LAMP stack (Linux Apache MySQL PHP) …

WINDOWS post image
Run any program as service in windows

Running a program as a service in Windows can be incredibly useful, allowing you to …

LINUX post image
How to setup on-premise MySQL master and slave servers

In this article I'll be demonstrating how you can configure MySQL master and slave …

Sign up or Login to post comment.

Comments (0)