How to Install OpenVPN Server on Ubuntu 20.04

How to Install OpenVPN Server on Ubuntu 20.04

On Ubuntu 20.04, we’ll set up the OpenVPN server. You’ll need to log in as the root user to do this. You’ll also need to know the server’s public IP, which clients will use to establish a secure VPN connection.

Installation and configuration of OpenVPN

We’ll use the script to install and configure all of the OpenVPN server’s required packages. All you have to do is provide it with your server’s correct public IP address. Let’s go ahead and download it.

$ wget https://raw.githubusercontent.com/angristan/openvpn-install/master/openvpn-install.sh

Make it a executable program.

$ chmod +x openvpn-install.sh

Run the script now.

$ ./openvpn-install.sh

You’ll be asked to confirm the values of some parameters that are set to their optimal values by default. The public IP address of the server is the only thing worth verifying. Changes to other settings should only be made if you know what you’re doing and why.

OpenVPN

The final step is to choose a client name and whether or not to protect the configuration with a password. It is preferable to use a password for security reasons.

When the procedure is complete, check to see if the OpenVPN server is accepting inbound connections

$ ss -tupln | grep openvpn

Client connection with OpenVPN

To demonstrate the client connection process, we’ll utilize another Ubuntu system. You can use this method to configure any Linux system, or you can get the Windows client from the OpenVPN website: https://openvpn.net/community-downloads/

You’ll get a notification at the end of the OpenVPN server configuration procedure stating that the client configuration has been created and the path to it has been specified. It should be downloaded to the client.

$ scp user@vpn-server:/path/to/configuration.ovpn /home/user

Install the OpenVPN client on your computer

$ sudo apt install openvpn

Begin the client by specifying the location of the configuration file that was downloaded from the server.

$ openvpn --config /path/to/configuration.ovpn

The next line indicates that the connection was successfully created.

Wed Apr 6 19:59:58 2022 Initialization Sequence Completed

You can either add new OpenVPN clients or remove one.

Run the script again and select the relevant option to add or remove clients from the server or to delete OpenVPN.

$ ./openvpn-install.sh

Output:

What do you want to do?
1) Add a new user
2) Revoke existing user
3) Remove OpenVPN
4) Exit
Select an option [1-4]:

To install OpenVPN Server on Ubuntu 22.04

Follow us TwitterFacebookLinkedIn

Open Source Listing

Previous Post
Next Post

Comments

Avatar for Sign Up
Sign Up

I have read your article carefully and I agree with you very much. This has provided a great help for my thesis writing, and I will seriously improve it. However, I don’t know much about a certain place. Can you help me?

Leave a Reply