In this tutorial you’ll learn how to setup a private vpn server on CentOS

Requirements :

A virtual private server(VPS, with a min of 128mb ram) OpenVPN Software

If you’re planning to use only openvpn on your server, a small cheap vps would be good to go, but always be sure to check their bandwidth plan if you’ll be using it heavily.

There are many hosting providers from where you can get some really nice servers with affordable prices.

Here are 3 vps providers from where you can get a cheap VPS :

Virmach – Starting at $1.25/Month

Vultr– Starting at $2.50/Month

DigitalOcean– Starting at $5/Month

It is completely up to you which hosting provider you choose to go with.

yum update

2.Download OpenVPN package

Make sure to download the right version that is compatible with your server os.

For CentOS 6 32b

wget http://swupdate.openvpn.org/as/openvpn-as-2.5-CentOS6.i386.rpm

For CentOS 6 64b

wget http://swupdate.openvpn.org/as/openvpn-as-2.5-CentOS6.x86_64.rpm

For CentOS 7 64b

wget http://swupdate.openvpn.org/as/openvpn-as-2.5-CentOS7.x86_64.rpm

3.Install OpenVpn

yum install openvpn-as-2.5-CentOS6.x86_64.rpm

4.Set a password to user openvpn

passwd openvpn

If you cant access your server after installing, you need to remove the current installation and reinstall it via this command.

/usr/local/openvpn_as/bin/ovpn-init

answer yes to it, and on "Please specify the network interface and IP address to be" step make sure to select 1 and press enter.

Please specify the network interface and IP address to be used by the Admin Web UI: (1) all interfaces: 0.0.0.0 (2) eth0: 104.238.158.93 Please enter the option number from the list above (1-2). > Press Enter for default [2]: 1

Try to access your server

Admin UI : https://xx.xx.xx.xxx:943/admin

Web client : https://xx.xx.xx.xxx:943

You need to login to client ui with the same username and password you set during the installation.

Once you’re logged in, download the ovpn file, and import it to the software that you want to use to connect to your vpn.