News
Seven days of Black Friday madness — great deal from Serverspace!

THE NEW YEAR
WHEEL OF FORTUNE

Spin the wheel and win a guaranteed prize right now!

By registering, you are signing up to receiving emails.
JH
Joe Harris
December 15 2020
Updated December 11 2024

How to Install OpenVPN Server on Ubuntu 20.04

Linux Ubuntu VPN

Using another OS?

Select the desired version or distribution.

In this tutorial, we will install the OpenVPN server on Ubuntu 20.04. To do this, you need to log in as the root user. You also must know the public IP of the server with which clients will establish a secure VPN channel.

OpenVPN installation and configuration

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

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

Make it executable.

chmod +x openvpn-install.sh

Now run the script.

./openvpn-install.sh

You will be asked to confirm some parameters that have optimal values by default. The only thing that is really worth checking is the public IP of the server. Other parameters should only be changed if you understand what you are doing and why.

OpenVPN installation settings
Screen 1. OpenVPN installation settings.

In the last step, you need to set the client name and choose whether to protect the configuration with a password or not. For security reasons, it's better to set a password.

When the process is over, you can check whether the OpenVPN server is listening for incoming connections.

ss -tupln | grep openvpn
OpenVPN server is listening for incoming connections
Screen 2. OpenVPN server is listening for incoming connections.

OpenVPN client connection

We will use another Ubuntu machine to show the client connection process. You can configure any Linux system in this way or download the Windows client from the OpenVPN web site: https://openvpn.net/community-downloads/

At the end of the OpenVPN server configuration process, you will see a message stating that the client configuration has been created and the path to it is specified. Download it to the client.

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

Install the OpenVPN client.

sudo apt install openvpn

Now start the client and specify the path to the configuration downloaded from the server.

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

The next line shows that the connection was established successfully.

Wed Dec 9 19:59:58 2020 Initialization Sequence Completed

Add more OpenVPN clients or delete one

To add or remove clients on the server or delete OpenVPN, run the script again and select the appropriate option.

./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]:

Vote:
5 out of 5
Аverage rating : 5
Rated by: 9
1101 CT Amsterdam The Netherlands, Herikerbergweg 292
+31 20 262-58-98
700 300
ITGLOBAL.COM NL
700 300
We use cookies to make your experience on the Serverspace better. By continuing to browse our website, you agree to our
Use of Cookies and Privacy Policy.