Using a VPN (Virtual Private Network) ensures your online activities remain private and secure. This guide covers installing and configuring an anonymous VPN on Ubuntu using OpenVPN and WireGuard

Step 1: Choose a VPS Provider
Before proceeding, select a reliable VPS plan for your VPS:
- Kid vps plan (recommended)
Ensure the provider offers OpenVPN/WireGuard configuration files.
Installing and Configuring OpenVPN
Step 2: Install OpenVPN
To use OpenVPN, install the necessary packages:
sudo apt update
sudo apt install openvpn network-manager-openvpn network-manager-openvpn-gnome
Step 3: Download OpenVPN Configuration Files
- Log in to your VPN provider’s website.
- Download the OpenVPN configuration files (.ovpn) for your desired server locations.
Step 4: Add OpenVPN to Network Manager
- Open Settings > Network > VPN.
- Click + to add a new VPN.
- Select Import from file.
- Choose the downloaded
.ovpn
file. - Enter your VPN credentials (username and password).
- Save the configuration.
Step 5: Connect to the VPN
- Go to Settings > Network > VPN.
- Toggle the VPN connection ON to connect.
- Verify the connection by checking your IP address:
curl ifconfig.me
Installing and Configuring WireGuard
Step 6: Install WireGuard
WireGuard is a lightweight and fast VPN protocol. To install it, run:
sudo apt update
sudo apt install wireguard
Step 7: Download WireGuard Configuration Files
- Log in to your VPN provider’s website.
- Download the WireGuard configuration files (.conf) for your desired server locations.
Step 8: Configure WireGuard
- Move the downloaded
.conf
file to the/etc/wireguard/
directory:sudo mv /path/to/your-config.conf /etc/wireguard/wg0.conf
- Set the appropriate file permissions:
sudo chmod 600 /etc/wireguard/wg0.conf
Step 9: Start WireGuard
Activate the WireGuard VPN connection:
sudo wg-quick up wg0
To disconnect:
sudo wg-quick down wg0
Step 10: Enable WireGuard on Boot
To ensure WireGuard starts automatically on boot:
sudo systemctl enable wg-quick@wg0
Step 11: Test Your VPN Connection
- Check IP Address: Ensure your public IP address has changed:
curl ifconfig.me
- DNS Leak Test: Visit https://dnsleaktest.com to confirm your DNS requests are routed through the VPN.
- WebRTC Leak Test: Check for WebRTC leaks on https://browserleaks.com/webrtc.
Troubleshooting
- OpenVPN Issues: Ensure credentials and
.ovpn
files are correct. - WireGuard Conflicts: Verify file permissions and configuration settings.
- Firewall Problems: Ensure your firewall is configured to allow VPN traffic.
Conclusion
By following these steps, you’ve installed and configured an anonymous VPN on Ubuntu using both OpenVPN and WireGuard. A VPN enhances your online privacy, protects your data, and keeps your connection secure. Keep your VPN software and configuration files updated for optimal security.