How to Install Your Own Forever Free OpenVPN Server on Ubuntu. Oracle Always Free Tier
3 min read
1 day ago
Published on Jan 27, 2025
This response is partially generated with the help of AI. It may contain inaccuracies.
Table of Contents
Introduction
This tutorial will guide you through the process of setting up your own OpenVPN server on an Ubuntu instance using Oracle Cloud's Free Tier. By the end of this guide, you'll have a fully functional VPN server that you can use for secure internet access.
Step 1: Install OpenVPN Access Server on Ubuntu
- Create an Ubuntu instance on Oracle Cloud's Free Tier.
- Connect to your instance via SSH:
ssh username@your_instance_ip
- Update your package list:
sudo apt update
- Install the OpenVPN Access Server:
sudo apt install openvpn-as
Step 2: Open Ports in Ubuntu iptables and Oracle Cloud Console
- Open ports in iptables:
sudo iptables -A INPUT -p tcp --dport 443 -j ACCEPT sudo iptables -A INPUT -p udp --dport 1194 -j ACCEPT
- Open the Oracle Cloud Console and navigate to your instance settings.
- Edit the security list to allow inbound traffic on ports 443 and 1194.
Step 3: Add OpenVPN Repository and Install OpenVPN
- Add the OpenVPN repository:
sudo add-apt-repository -y ppa:openvpn/openvpn
- Update package lists again:
sudo apt update
- Install OpenVPN:
sudo apt install openvpn
Step 4: Configure Public IP and Client Specific DNS
- Edit the OpenVPN server configuration file:
sudo nano /usr/local/openvpn_as/etc/as.conf
- Set your public IP in the configuration.
- Specify the DNS server for clients, if necessary.
Step 5: Create New VPN User and Set Password
- Create a new user for VPN access:
sudo /usr/local/openvpn_as/scripts/sacli --user newuser --key "prop_superuser" --value "true" UserPropPut
- Set a password for the new user:
sudo /usr/local/openvpn_as/scripts/sacli --user newuser --new_pass=YOURPASSWORD SetLocalPassword
Step 6: Download OpenVPN Client and Connect to VPN Server
- Download the OpenVPN client from the official site or your preferred platform.
- Import the configuration file provided by the OpenVPN server into your client.
- Connect to the VPN using your new user credentials.
Step 7: Fix Invalid SSL/TLS Certificate Error
- If you encounter an SSL/TLS error, ensure that your server's public IP is correctly configured in the OpenVPN settings.
- You may need to regenerate the SSL certificates using:
sudo /usr/local/openvpn_as/scripts/ovpn-init
Step 8: Reset Super Admin Password
- To reset the super admin password, use the following commands:
cd /usr/local/openvpn_as/scripts ./sacli --user "openvpn" --key "prop_superuser" --value "true" UserPropPut ./sacli --user "openvpn" --key "user_auth_type" --value "local" UserPropPut ./sacli --user "openvpn" --new_pass=NEWPASSWORD SetLocalPassword ./sacli start
Conclusion
You have now successfully set up your own OpenVPN server on an Ubuntu instance using Oracle Cloud's Free Tier. This setup allows you to securely connect to the internet and maintain privacy. For further enhancements, consider looking into firewall configurations or additional user management features.