openvpn in ubuntu

Setup Openvpn In 2 minutes

Author - Sushmita Rimal
July 29. 2 min read


Setting Up OpenVPN Server on Ubuntu and Creating Users

OpenVPN is an open-source and free software application that allows secure virtual private network (VPN) connections over the internet. With an OpenVPN server, you can access your home or office network from anywhere in the world as if you were physically present there. In this tutorial, we will guide you through the process of setting up an OpenVPN server on Ubuntu using a bash script.

Prerequisites:

OpenVPN Setup on Ubuntu Server:

  1. First, download the bash script from the GitLab repository by running the following command in the terminal:
  2. git clone https://gitlab.com/Sushmii/openvpn-in-linux.git

    Note: Use sudo su to execute all commands without encountering errors.

  3. Navigate to the 'openvpn-in-linux' folder and replace 'VPN.SERVERNAME.COM' with your domain name or server IP. After making the necessary changes, make the bash script executable by running the following command:
  4. chmod +x openvpn-setup.sh
  5. Run the bash script to set up the OpenVPN server on Ubuntu by executing the following command:
  6. ./openvpn-setup.sh

Creating OpenVPN Users:

  1. To create an OpenVPN user, ensure that the 'create-or-delete-users.sh' file is executable. You can achieve this by running the following command:
  2. chmod +x create-or-delete-users.sh
  3. Now, you can create a new OpenVPN user on Ubuntu by executing the following command:
  4. ./create-or-delete-users.sh

    This bash script allows the user to add or remove users from an OpenVPN server. If the user selects "add," the script prompts for a new username, creates an OpenVPN user with Docker, and generates necessary configuration files. If "remove" is chosen, the script asks for the username, revokes the user's certificate, and removes associated files. If an invalid action is entered, it displays an error message prompting the user to choose "add" or "remove." The script will also establish a new directory for the user's files and generate the client configuration for the OpenVPN Ubuntu client.



You can find all the commands and scripts on my GitLab repository: https://gitlab.com/Sushmii/openvpn-in-linux



Conclusion:

In this tutorial, we have successfully set up an OpenVPN server on Ubuntu using a bash script. Moreover, we have learned how to create an OpenVPN user for the Ubuntu server. By implementing this setup, you can securely access your home or office network from any location worldwide, just as if you were physically present there. Additionally, the process includes configuring an Ubuntu OpenVPN server with a GUI for easier management.



If you Liked my blog ,Follow on LinkedIn


People who read this also read

how to deploy website in netlify for free

Host a website for free in netlify

Sushmita Rimal
22 July | 15 min read
article

Deploying an ELK Stack with TLS in Kubernetes

Sushmita Rimal
07 Jun | 5 min read
article

Unveiling the Hidden Secrets of HPA: How does HPA work?

Sushmita Rimal
07 Jun | 6 min read