? Article 6: How to Install & Configure OpenVPN Client on Ubuntu 22.04 LTS
???? Part A: Preparation
You will need:
-
A system running Ubuntu 22.04 LTS.
-
An .ovpn configuration file (provided by your IT/security team or VPN admin).
-
Internet connection.
???? Hint: The .ovpn file contains server details, certificates, and keys. Sometimes extra files (ca.crt, client.crt, client.key, ta.key) are given separately.
???? Part B: Install OpenVPN
-
Update system:
sudo apt update && sudo apt upgrade -y
-
Install OpenVPN:
sudo apt install openvpn -y
-
Confirm installation:
openvpn --version
✅ Should display version info.
???? Part C: Connect using .ovpn file
-
Place your .ovpn file in /etc/openvpn/:
sudo cp /path/to/file.ovpn /etc/openvpn/client.conf
???? Rename file to client.conf so OpenVPN service can use it.
-
Start OpenVPN with config:
sudo systemctl start openvpn@client
-
Enable auto-start on boot:
sudo systemctl enable openvpn@client
-
Check status:
sudo systemctl status openvpn@client
???? Part D: Manual Test Connection
If you just want to test without enabling as a service:
sudo openvpn --config /path/to/file.ovpn
-
You will see logs in the terminal.
-
Keep terminal open while connected.
-
Press Ctrl + C to disconnect.
???? Part E: Network Manager (GUI method)
For end users who prefer a click-based setup:
-
Install plugin:
sudo apt install network-manager-openvpn -y
-
Restart Network Manager:
sudo systemctl restart NetworkManager
-
Open Settings → Network → VPN → Add.
-
Choose Import from file… → select your .ovpn file.
-
Enter username/password if required.
-
Save → Turn VPN switch ON.
✅ VPN connected.
???? Part F: Verify VPN Connection
-
Check your IP:
curl ifconfig.me
-
Should show VPN’s IP, not your local ISP.
-
Ping test:
ping -c 4 google.com
✅ If replies come, VPN is working.
???? Part G: Handling Separate Certificate Files
If instead of one .ovpn, you receive separate files:
-
ca.crt → Certificate Authority
-
client.crt → Client Certificate
-
client.key → Private Key
-
ta.key → TLS Auth key
Edit the .ovpn file with:
ca /etc/openvpn/ca.crt
cert /etc/openvpn/client.crt
key /etc/openvpn/client.key
tls-auth /etc/openvpn/ta.key 1
Then copy all files to /etc/openvpn/ and restart OpenVPN.
???? Part H: Common Errors & Fixes
-
“Cannot load certificate/key” → Ensure correct file paths in .ovpn.
-
“AUTH failed” → Wrong username/password; check with VPN admin.
No Internet after connecting → DNS not pushed by server → add:
dhcp-option DNS 8.8.8.8
-
inside .ovpn.
-
Service won’t start → Run manual test (sudo openvpn --config client.ovpn) to see detailed error.
General Hints ????
-
Keep a backup of your .ovpn file in a safe folder.
-
If VPN drops frequently, check firewall or ISP blocking UDP; try switching to TCP in config.
-
To stop auto-start VPN at boot:
sudo systemctl disable openvpn@client
-
For GUI users: always install network-manager-openvpn for smoother experience.
✅ You now have OpenVPN client installed and working on Ubuntu 22.04.