In ever-increasing threats against internet users, VPN provides a safe way to access the internet as it secures our data communications. Not only that, but VPN also provides internet privacy for remote employees for an organization, for securing IOT & also for networking cloud data centers.

In this article, we are going to discuss the installation of OpenVPN on Linux. OpenVPN is one of the most recognized VPN services provides & is ideal for use especially for organizations that want their data secured. OpenVPN uses the public internet to provide a secure & isolated private network.

Using OpenVPN on Linux, we can minimize the risk of unauthorized access to specific networks. Even on unsecured networks like public WIFI, it provides encryption to secure the data. It also provides centralized management for users.

OpenVPN consists of two parts;

1- OpenVPN access server, is the main server & acts as a centralized management console for user management,

2- OpenVPN client, it is required to be installed on all client systems that are to be connected to the OpenVPN server.

Recommended Read: Informative guide to useful Linux shortcuts

Also Read: How to Add and Remove Users in Ubuntu

In this tutorial, we will learn to install both, so let’s start the installation of OpenVPN on Linux,

Installing OpenVPN on Linux (Access Server)

Before we install OpenVPN access server, we actually need to install some pre-requisites first. Install the ‘net-tools’ & ‘wget’ by executing the following command from the terminal,


# yum install net-tools wget


$ sudo apt-get install net-tools wget

Now we also need to ensure that time on our system is never out of sync as this can cause a problem with certificate authentication, moreover, 2-factor authentication will not happen on servers with time out of sync. So also need to install ‘ntp’ package on the servers,


# yum install ntp


$ sudo apt-get install ntp

Now we can install OpenVPN on Linux machines, in the next step we will download the required packages for installation,


# wget


$ wget

Packages for older distributions are also available & can be downloaded using the following command,


# wget

Ubuntu 16

$ wget

Once downloaded, we will install the OpenVPN packages with the following command,


# rpm -Uvh openvpn-as-latest-CentOS7.x86_64.rpm


$ sudo dpkg -i openvpn-as-latest-ubuntu18.amd_64.deb

The installation will now start & we will get information regarding the location of configuration files, service file location, etc,

install openvpn

Service will be started by default upon installation, but we can restart the same with the following command,

# systemctl restart openvpnas

We can now access GUI from a web browser but before we do that, we need to reset the password for the admin user of OpenVPN access server,

# passwd openvpn

Once the password has been set, open the following URL from a web browser,

here is the system IP where we have installed the OpenVPN Access server. We will now be asked to enter the credentials,

install openvpn

Once we have signed in, we will be asked to agree on end user license agreement, read it & then accept it,


install openvpn

next, we can see the admin console for OpenVPN,


install openvpn


Under User management, we can create client users. Create one so that we can connect & check it.

Note: if you are using the firewall on your system, make sure that TCP 443, TCP 943, and UDP 1194 are allowed.

Install OpenVPN client on Linux

Once we have a user ready in OpenVPN access server, we can use that user to connect to the VPN from a remote system. But we need to install the openvpn client software first. Install it using the following commands from the terminal,


# yum install openvpn


$ sudo apt-get install openvpn

Once installed you can check the version using the following command,

# openvpn --version

Next step would be to download the client configuration file named ‘client.ovpn’ from the access server client UI, enter the following URL to connect to the same,

Notice here, it is the same URL that we have used to access the admin portal but we have only omitted admin part from URL. Enter the credentials & we will be directed to the following screen,


install openvpn


Click on last option ‘Yourself (user-locked profile)’ & a file will be downloaded. This is the same file we need to connect to the VPN. To connect to OpenVPN, run the following command,

# openvpn --config client.ovpn

Note:- Enter the complete path for client.ovpn file, if you are in a different directory than the client.ovpn file location.

Now the process will start to connect to OpenVPN,

install openvpn

Once this completes, we will be connected to the OpenVPN & this ends our tutorial on installation of OpenVPN on Linux machines.

Please do send us any questions or queries you have regarding the tutorial using the comment box below.

If you think we have helped you or just want to support us, please consider these:-

Connect to us: Facebook | Twitter | Google Plus

Become a Supporter - Donate us some of you hard earned money: [paypal-donation]

Linux TechLab is thankful for your continued support.