· df · 1 min read

OpenVPN configuration for CentOS

piavpncentosopenvpnprivateinternetaccess

This article is specifically for PrivateInternetAccess on CentOS. As you might see there are no written packages/support for CentOS. I've followed a very good article from this link , but that was not enough as I had to tweak a lot afterwards.
Just to write down the key points here

  • Install OpenVPN using yum (enable EPEL beforehand)
 sudo yum install openvpn

Please follow all steps as per this article. 
Hope you have copied all VPN files in /etc/openvpn and the credentials to /root/.pia

When you start, VPN it throws an error


[root@localhost openvpn]# systemctl start openvpn@server.service
Job for openvpn@server.service failed. See 'systemctl status openvpn@server.service' and 'journalctl -xn' for details.

This is because you need to ensure the files/configurations you put in /etc/openvpn needs to be "Set files with the openvpn_etc_t type"


How to set files with a specific type


Please follow below instructions
sudo su - 
cd /etc/openvpn/
semanage fcontext -a -t openvpn_etc_t  <each_file>
/sbin/restorecon -v  <each_file>

later you check status or start/stop vpn
systemctl status openvpn@server.service
systemctl start openvpn@server.service
systemctl stop openvpn@server.service