Blog

Install Openvpn in Ubuntu

Rahmat Subandi / 02 January, 2023

5 min read––– views

Introduction

Hi, on this occasion I will discuss how to make your own VPN, with the help of OpenVPN.

What is VPN?

A VPN or Virtual Individual Network (Virtual Private Network) creates a private network connection between features via the internet. VPNs are used to transmit information conveniently and anonymously over public networks. VPN works by hiding the user's IP address and encrypting information so that it cannot be read by anyone who is not authorized to receive it. [1]

What is OpenVPN?

OpenVPN is a virtual private network system that implements methods for creating convenient point-to-point or site-to-site connections in routed or bridged configurations and remote access facilities. It implements client as well as server applications. [2]

OpenVPN is an open source technology that they developed in 2002 by a programmer named James Yonan. The OpenVPN protocol subsequently evolved to toughen web to web and point to the primary connection for business users connecting to industrial networks from remote locations. OpenVPN is designed with a “custom” information security protocol that uses cryptography/TLS/SSL encryption to secure online communications and data transfers. [3]

Prerequisite

To follow this article make sure you already have a VPS with the Ubuntu operating system. In the article I'm using Ubuntu version 20.40

Connect to VPS

To connect to a server that you already have is very simple. You can use the terminal/comand prompt on your computer or you can use PuTTY if you have it, but I will give an example using the built-in terminal only. For the steps, please follow the steps below:

  1. Open teriminal
bash
ssh root@IP_ADDRESS

# NOTE: you can replace root with the user you have, but you don't need to change it, because root is the highest access right in the scope of ubuntu. And IP_ADDRESS replace with your server IP
  1. If you log into the server for the first time, there will be a warning like this: bash1
  2. Then enter the server password that you have created.
  3. And done, you are connected to your server. bash2

Install OpenVPN

  1. Please follow the step-by-step below:
bash
wget -qO - https://as-repository.openvpn.net/as-repo-public.gpg | apt-key add -
echo "deb http://as-repository.openvpn.net/as/debian focal main">/etc/apt/sources.list.d/openvpn-as-repo.list
apt update
  1. Then type the command below to install the OpenVPN access server:
bash
apt install openvpn-as
  1. When successful you will see something like the image below: bash3

Finally the installation is complete, let's move on to the next stage to try the VPN that we have made

Hello, OpenVPN!

  1. Let's try to access the url we have got vpn1 Enter the username and password that we got when the installation process was complete.

  2. After successfully logging in for the first time OpenVPN will display an agreement that we can read (if you want😜) just click the Agree button. vpn2

  3. And, here weee gooo🔥🔥🔥 vpn3

Setup basic (If you want)

  1. In submenu CONFIGURATION, click VPN Settings. Scroll down to the Routing section, and select Novpn4
  2. (OPTIONAL) Still on the same page, scroll down a bit, in the DNS Settings section, Select Yes to Have clients use specific DNS servers. And insert 1.1.1.1 for Primary DNS Server, 1.0.0.1 for Secondary DNS Server. vpn5
  3. Click Save Settings, after that at the top there will be an alert, click Update Running Server again. vpn6

Create User

  1. In the sidebar of the USER MANAGEMENT section, click User Permissions.
  2. Type in the username, check the Allow Auto-login section, so that every user who wants to use a VPN must enter a username and password first.
  3. Then click More Settings with the Pencil icon, enter the password for the user, the rest doesn't need to be in settings anymore, but if you want, you can do it. vpn7
  4. Click Save Settings, after that at the top there will be an alert, click Update Running Server again. vpn6

Let's try it

The final step of this article, let's try the VPN that we have created.

  1. Enter the given URL (without /admin) vpn8
  2. Enter the Username and Password of the users that we have created.
  3. And this is the dashboard display from the user, please download the application according to the operating system you are using, you can also download the application on the Play Store and App Store. (I tried it using Android)vpn9
  4. Next, enter the Username and Password. The Import autologin profile option can be checked.vpn10
  5. After a successful download, the initial screen will look like this: (Remember, I tried it on android). Enter your server IP address.vpn10
  6. When successfully connected it will be like this:vpn10
  7. And this is the list of VPNs in your accountvpn10

Conclusion

Thank you for following this article to the end, I hope the author and readers get useful knowledge in the future.

Reference