This guide shows how to turn your VPS into a personal VPN server with OpenVPN, then connect to it from your PC or phone.
-
Connect to your VPS
ssh root@YOUR_VPS_IP -
Download the installer
curl -O https://raw.githubusercontent.com/angristan/openvpn-install/master/openvpn-install.sh chmod +x openvpn-install.sh -
Run it and answer the questions
./openvpn-install.shThe defaults are fine for most users: UDP, port
1194, and the DNS provider of your choice. When asked for a client name, enter something likelaptoporphone. -
Open the port in your firewall
If you use a firewall on the VPS or in the RHQ client area, allow UDP 1194 (or the port you chose).
ufw allow 1194/udpfirewall-cmd --permanent --add-port=1194/udp firewall-cmd --reload -
Download the client profile
The script creates a file like
/root/laptop.ovpn. Copy it to your computer:scp root@YOUR_VPS_IP:/root/laptop.ovpn . -
Connect
Install OpenVPN Connect (Windows, macOS, Android, iOS), import the
.ovpnfile and press Connect. Your public IP should now be the IP of your VPS.
Add or remove clients
Run the script again and choose the matching option from the menu:
./openvpn-install.shTroubleshooting
It connects but there is no internet
Check that IP forwarding is enabled (sysctl net.ipv4.ip_forward should return 1) and that the NAT rule created by the script is still present (iptables -t nat -L -n).
The connection times out
The port is almost certainly blocked. Confirm the OpenVPN service is running with systemctl status openvpn* and that UDP 1194 is open in every firewall between you and the VPS.