How to Setup OpenVPN on a VPS - Build Your Own VPN (2026)
How to Setup OpenVPN on a VPS - Build Your Own VPN (2026)
In the era of remote work and cross-border e-commerce, securing your internal data flow and possessing a clean, static IP address is crucial. Cheap, public VPN services often come with data leakage risks and force you to share IPs with thousands of other users, which easily flags your business accounts as suspicious.
The ultimate and most secure solution today is building a Self-hosted VPN. This guide will show you how to set up a fully automated OpenVPN server on a VPS or Dedicated Server using just a single command line.
1. Why Do Businesses Need a Self-Hosted VPN?
Owning a private Virtual Private Network (VPN) server provides core values that no commercial shared VPN service can match:
- Full Data Control (Customizable Log Policies): Your entire internal data stream is end-to-end encrypted. OpenVPN utilizes TLS protocol and AES-256-GCM encryption, the current gold standard for enterprise security. You are the sole owner of the server, ensuring full control over your log storage policies and browsing history.
- Manage Multi-region Accounts with a Dedicated IP: Possessing a static, unique IPv4 helps businesses safely manage ad accounts or e-commerce stores (Facebook, TikTok, Amazon). This significantly minimizes the risk of automated account bans caused by constant IP changes or sharing a blacklisted IP with rule-violating users.
- Enterprise Intranet Security: Allows employees to securely connect to the internal network (Accounting software, ERP) from coffee shops or public Wi-Fi without opening server ports to the public Internet, completely preventing hacker intrusions.
Here is a quick comparison table to help you visualize the differences:
| Criteria | Public VPN (Shared) | Self-Hosted VPN on VPS |
|---|---|---|
| IP Address | Shared with thousands of users | Dedicated & Static IPv4 |
| Log Storage | Cannot be fully verified | Full Control over Log Policies |
| Intranet Security | Limited, cannot route to local servers | Fully Customizable (Port Control) |
| Account Ban Risk | Very High (Shared IPs are often blacklisted) | Very Low (Clean IP Reputation) |
2. Why Choose a VietHosting VPS for Your VPN Server?
VPN encryption protocols (especially AES-256-GCM) demand continuous CPU processing capability and low network latency. Running a VPN on a poor-quality platform will severely degrade your access speed.
- Highly Reputable IPs: Our system uses private IPv4 ranges that are strictly managed and thoroughly checked against reputable IP Reputation systems before handover, enhancing reliability when working with international platforms.
- 1Gbps Uplink, Optimized for International Routing: For VPNs, bandwidth is a matter of survival. Strict resource management without overselling ensures stable throughput. The network routing is specifically optimized for international connections, minimizing latency when accessing cross-border services.
- Enterprise Hardware: Powered by Intel Xeon Platinum CPUs and 100% Enterprise SSD/NVMe storage with RAID-10.
3. Automated OpenVPN Installation Guide
You don't need to be a System Administrator to set this up. VietHosting has packaged the entire complex configuration process into a single automated script.
System Preparation
- A VPS or Dedicated Server pre-installed with a modern OS: Ubuntu (22.04, 24.04) or RHEL family (AlmaLinux 8/9, Rocky Linux 8/9).
- An SSH client (like PuTTY or Terminal) logged in with
rootprivileges.
Execute the Installer from VietHosting Mirrors
In your VPS command-line interface, simply copy and paste the following code, then hit Enter:
Internally Verified Resources
This installation script is hosted directly on VietHosting's internal Mirrors Storage System, guaranteeing absolute safety, no malicious code, and lightning-fast download speeds.
The script will automatically update the OS, install the Easy-RSA library, generate a Certificate Authority (CA), configure the Firewall (UFW/Firewalld), and set up IP Forwarding routing in just 1 to 2 minutes.
4. Effortless VPN User Management (Add/Revoke)
The brilliance of this tool lies in its highly intuitive Management Menu that appears right after the installation is complete.
How to create a new VPN user account
- When the menu appears, press 1 to add a new user (or 2 for batch creation).
- Enter an identifier name (e.g.,
agency_ads_1). - The system will auto-generate the certificate and output an
.ovpnfile in the/root/openvpn-clients/directory. - Simply use WinSCP/FileZilla to download this file and import it into the OpenVPN Connect app on your PC or smartphone to start using it immediately.
How to revoke VPN access instantly
If an employee resigns or a device is compromised, you can just re-type the command bash openvpn-installer.sh to bring up the Menu again:
- Select option 3 (Revoke a user).
- The system will list existing users. Type the name of the user you wish to remove.
- Their certificate will immediately be added to the Certificate Revocation List (CRL), instantly terminating any active connections from that device.
Conclusion
Building an enterprise-grade OpenVPN system has never been this simple and secure. By combining an automated installer script with a VPS on a robust server infrastructure, you have taken full control of your data flow and network identity.
If you are looking for a rock-solid platform to run this VPN system, the KVM VPS or Large VPS packages at VietHosting are the optimal choices. Our 24/7 technical support team is always ready to assist you in deploying this setup on your server completely free of charge.
