OpenVPN is an open source application that allows us to create a SSL based virtual private network (VPN) that supports both site-to-site  & client-to-site tunnels. It allows us to connect to a remote location as if we are in the same network as remote location.In this tutorial, we will discuss how to install OpenVPN on CentOS.

The same process (mentioned below) can also be used to install OpenVPN on Debian & Ubuntu as well. For this tutorial, we will be using a script that will automate the whole process to install OpenVPN. We will start by discussing the pre-requisites to install OpenVPN.

(Recommended Read: Create your own personal Cloud: Install OwnCloud )


  • For CentOS, we need to have EPEL repository installedon our system as there are some dependencies that are available with EPEL repo only. Install EPEL repo with the following command onto your system,\


$ sudo dnf install


$ sudo rpm -Uvh

RHEL/CentOS 6 (64 Bit)

$ sudo rpm -Uvh

RHEL/CentOS 6 (32 Bit)

$ sudo rpm -Uvh

  • For Ubuntu, Debian , we will not need extra repository as all the dependencies can be resolved with default repos only.


Install OpenVPN

Note:- The process mentioned below will be same to install OpenVPN on CentOS, Debian & Ubuntu.

As  mentioned above, we will be using a script to automate the procedure to install OpenVPN. So , open terminal & execute the following command to download the script onto the system,

$ wget -O

Now provide it execute permissions,

$ chmod +x

Note:- Before we execute the script, make sure that we have logged in as user ‘root’.

Now start the installation by executing the script,

$ ./

Setup will now start , follow the on-screen instructions as we need to provide some information needed by setup to continue,

1- As soon as the script runs, we will be asked to provide the IP address for network interface that OpenVPN will listen to, for us its,

install OpenVPN

2- Next it will ask for protocol type we want to use, we have kept is default but you can also choose ‘tcp’ by pressing ‘2’,

install OpenVPN

3- Next, we will be asked to enter the port number for OpenVPN, we are also keeping it default i.e. 1194. You can change it, if needed,

install OpenVPN

4- Next, we need to select the DNS that we will be using with OpenVPN, we have selected ‘Google’ for our server,

install OpenVPN

5- Next provide the name for client certificate, it should be a single letter word with no special character,

install OpenVPN

6- Setup will now continue & will take some time to complete,

install OpenVPN

7- On the last step, we will be asked to provide an External IP address. Mention if you have one, otherwise just press enter for the setup to complete.

install OpenVPN

8- Our setup is now complete & our client certificates have been created. We will need this certificate as this certificates needs to copied onto all client machine that will connect to OpenVPN server.


Configuring Clients

Copy the created certificate to client system using the following command (run command from OpenVPN server),

$ scp –rv /root/Nodes.ovpn root@

Here,  is  the IP address of the client that will connect to OpenVPN.

Now login to the client system & install OpenVPN with the following command,

$ sudo yum install openvpn

Note:- We might need to enable EPEL repo on client system as well for OpenVPN installation.

For Ubuntu, run the following command,

$ sudo apt-get install openvpn

Now the client system is ready to be connected to openvp, open the terminal & execute the following command to start using OpenVPN,

$ openvpn --config /root/Nodes.ovpn

install OpenVPN

Congratulations, you have successfully installed & connected to OpenVPN.

With this we end our tutorial on how to install OpenVPN on CentOS, Ubuntu. Please do send in your queries to us,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

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

Linux TechLab is thankful for your continued support.