Easy steps OpenVPN installation in CentOS, Debian, Ubuntu

This guide will assist you to install OpenVPN service with simple steps. Thanks to Nyr.
I'm using OpenVZ vps with CentOS 6 64bit. Lets begin..

First of all, check if Tun/Tap is enable.
 cat /dev/net/tun  
If it's enable, you will get response like this
 cat: /dev/net/tun: File descriptor in bad state  
If not, you should ask your VPS provider to enable it.

Now lets get OpenVPN auto installer script.
 wget http://git.io/vpn --no-check-certificate -O openvpn-install.sh; chmod +x openvpn-install.sh;   
And run it

The auto installer will start and will prompt you for some information

1. It will autodetect your public IP address. Change it only if you have multiple IP addresses on the server and you want to use a specific one.

2. Insert the port number used for incoming OpenVPN connections or use the default (1194). You can use any port, such as a random one, as long as it is not in-use by other service.

3. Choose your DNS resolver

4. You will be asked for a name of client certificate. You can use anything, e.g. “myname”

5. Grab a cup of coffee and wait until installation finish. :D

When its done, you can verify if OpenVPN service is running
 ps ax|grep openvpn  
You will get something like this
 6646 ?    Ss   0:00 /usr/sbin/openvpn --writepid /var/run/openvpn.server.pid --daemon ovpn-server --cd /etc/openvpn --config /etc/openvpn/server.conf  

Verify if traffic fowarding is enabled
 sysctl -p /etc/sysctl.conf  
You will see like this
If not, edit /etc/sysctl.conf and enable ipv4 forwarding by un-commenting the line “net.ipv4.ip_forward=1” removing the # sign and changing 0 to 1.
You can use WinSCP for this, alot easier.
Check again
 sysctl -p /etc/sysctl.conf   

Last step is IPtables rules
 iptables -t nat -A POSTROUTING -s -o venet0 -j SNAT --to xxx.xxx.xxx.xxx  
Where xxx.xxx.xxx.xxx is your VPS ip address

Dont forget to download the openvpn config in root/myname.ovpn

Now you need to install OpenVPN on your PC. Get it here (the Windows installer): http://openvpn.net/index.php/open-source/downloads.html

Copy the the openvpn config to \Program Files(x86)\OpenVPN\config\

Start OpenVPN GUI , Run as Administrator. Right click on its System Tray icon and click Connect.