OpenVPN is a flexible and secure Virtual Private Networking (VPN) solution. It uses SSL/TLS for key exchange and encryption, allowing you to connect safely to remote networks or protect traffic over untrusted connections. This guide explains how to install and configure OpenVPN on Ubuntu 20.04, 22.04, or later.
sudo apt update
sudo apt install openvpn easy-rsa -y
Easy-RSA helps generate SSL/TLS certificates for authentication.
make-cadir ~/openvpn-ca
cd ~/openvpn-ca
source vars
./clean-all
./build-ca
./build-key-server server
./build-dh
openvpn --genkey --secret keys/ta.key
Edit the server configuration file:
sudo nano /etc/openvpn/server.conf
Set parameters like port (default 1194), protocol (UDP recommended), and paths to certificates/keys.
sudo systemctl start openvpn@server
sudo systemctl enable openvpn@server
Check status:
sudo systemctl status openvpn@server
./build-key client1
Transfer the client certificate, key, and configuration file to the client system.
On the client machine:
sudo openvpn --config client1.ovpn
Note: HostPalace offers managed VPN hosting solutions with OpenVPN pre-configured for secure client access.