How to Setup OpenVPN on CentOS

Home » Guides » How to Setup OpenVPN on CentOS
Guides, How to No Comments
No votes yet.
Please wait...

centos-6.5

Linux-based CentOS is a free open-source operating system that is widely known for its straightforwardness, stability and ease of access. CentOS has been mainly developed to provide users with a sturdy open-source operating system to be used by home users, engineers, organisations and to accurately process scientific information. Ever since its development in 2004, CentOS has grown wide popularity over Debian OS to be the most successful Linux release. Unlike Ubuntu, CentOS relies on RPM format and the yum management tool and helps its users to offer web hosting services using a control panel.

In this tutorial, we will help you setup OpenVPN on CentOS in a series of simple and easy steps. Scroll down for more details.

Setting Up OpenVPN on CentOS

Follow the steps below to successfully configure OpenVPN on CentOS:

1. First of all, run the following command as superuser:

su

2. Next, enable “EPEL” as shown below:

Choose architecture CentOS 4 32bit CentOS 4 64bit CentOS 5 32bit CentOS 5 64bit CentOS 6 32bit CentOS 6 64bit CentOS 7 64bit

3. Download the components as shown in the command below:

yum update && yum install openvpn unzip

4. Next, download the configuration files you want to connect to. We will use bVPN as an example of a VPN service provider for demonstration purposes. You can download the configration files here: https://www.bvpn.com/en/accounts/profile/openvpn_server_list/ and then click on “Generate” after you choose your preferred VPN server.

5. Insert in your VPN credentials (username & password) as shown below:

echo  “username”  >> /etc/openvpn/credentials

echo “CHANGE TO YOUR PASSWORD” >> /etc/openvpn/credentials

6. Now, run OpenVPN and test if  your connection works properly.

openvpn –config /etc/openvpn/bvpn.conf –daemon

7. In order to confirm that your connection was successful, wait for a few seconds (30 seconds at least), and then run the command shown below:

curl https://www.bvpn.com/v1/api/client/ptr

You should receive a response such as this one:

{“status”:true,”ip”:”the external ip”,”ptr”:”PTR for the IP address”}

8. You are now good to go.

Congratulations! You are now connected to VPN and will automatically connect on reboot. If you have encountered any problems, kindly contact your VPN admin.

LEAVE A COMMENT