Table of Contents

Join Our Membership To Start Your Cybersecurity Journey Today!

How to setup OpenVPN Server on your Linux Server

OpenVPN is one of the best free and open source VPN protocols available. It is used for remote access, securing IoTs, IT services and data communication. It is a cross platform product and is available for Windows, iOS, Linux and many other Unix like operating systems.

 

Setting Up Linux OpenVPN Server

 

Here we’ll look at how to set up our own Virtual Private Server using OpenVPN. For this you’ll need a Linux or Windows Server (Amazon EC2 etc) but you can test OpenVPN on your Linux PC. We’ll use Amazon EC2 Debian Server Free tier in this example.

Connect to your Server using SSH or any other protocol. Download the following script to automatically install OpenVPN.

sudo apt update
sudo apt upgrade
wget https://git.io/vpn -O openvpn-install.sh

 

Now run this script to automatically install OpenVPN. This script will prompt you to enter your Public IP

sudo bash openvpn-install.sh

 

After that select your Transport layer protocol. UDP is recommended because it is faster but TCP is more reliable Transport layer protocol.

 

Then select your port no and DNS.

 

This will create an .ovpn file (“client.ovpn”) in your current directory which is used by client to connect to the VPN Server.

 

Connecting to the OpenVPN Server using .ovpn file

 

Download this file (“client.ovpn”) to your PC using netcat or any other tool. You can install OpenVPN client for Android, Windows, iOS or any other OS. For Linux type,

sudo apt install openvpn
sudo bash openvpn-install.sh

 

When the connection is initialized, check the Public IP of your PC using Google.

 

It works :)

Scroll to Top