ssh root@your-vps-ip
sudo apt-get update && sudo apt-get upgrade -y
sudo apt-get install openvpn easy-rsa -y
make-cadir ~/openvpn-ca cd ~/openvpn-ca
nano vars
export KEY_COUNTRY="US" export KEY_PROVINCE="CA" export KEY_CITY="SanFrancisco" export KEY_ORG="YourOrganization" export KEY_EMAIL="email@domain.com" export KEY_OU="YourOrganizationalUnit"
./clean-all ./build-ca
./build-key-server server
./build-dh
./build-key client
gunzip -c /usr/share/doc/openvpn/examples/sample-config-files/server.conf.gz > /etc/openvpn/server.conf
nano /etc/openvpn/server.conf
nano /etc/sysctl.conf
net.ipv4.ip_forward=1
sudo sysctl -p
sudo ufw allow 1194/udp sudo ufw allow OpenSSH sudo ufw enable
sudo nano /etc/ufw/before.rules
*nat :POSTROUTING ACCEPT [0:0] -A POSTROUTING -s 10.8.0.0/8 -o eth0 -j MASQUERADE COMMIT
sudo systemctl start openvpn@server
sudo systemctl enable openvpn@server
nano client.ovpn
client dev tun proto udp remote your-vps-ip 1194 resolv-retry infinite nobind persist-key persist-tun ca ca.crt cert client.crt key client.key cipher AES-256-CBC verb 3