Hey! No problem — switching from SOCKS5 proxies to
OpenVPN is a smart move for better security, privacy, and reliability. OpenVPN uses encrypted tunnels over SSL/TLS (the same tech behind HTTPS), so it's much more robust than basic SOCKS proxies.
Below is a
step-by-step tutorial to help you set up your own OpenVPN server. I'll also explain where to get SSL certificates (spoiler: you can generate them yourself for free using tools like easy-rsa or Let’s Encrypt).
Step 1: Choose Your VPS Provider
You need a Virtual Private Server (VPS) to host your OpenVPN server.
Recommended VPS Providers:
- DigitalOcean – Simple UI, good performance, $5/month droplet
- Linode – Reliable, great network
- Vultr – Global locations, cheap plans
- Hetzner Cloud – Affordable in Europe
- AWS EC2 / Google Cloud – More complex but powerful

Pick one and create a Linux VPS (Ubuntu 20.04/22.04 or Debian 11/12 recommended).
Step 2: Connect to Your VPS via SSH
Update the system:
Bash:
apt update && apt upgrade -y
Step 3: Install OpenVPN & Easy-RSA
Install OpenVPN and Easy-RSA (tool to manage certificates):
Bash:
apt install openvpn easy-rsa -y
Step 4: Set Up Certificate Authority (CA)
We’ll generate our own
SSL/TLS certificates — no need to buy them!
Initialize PKI (Public Key Infrastructure):
Bash:
make-cadir ~/openvpn-ca
cd ~/openvpn-ca
Edit the vars configuration:
Set these values (customize as needed):
Bash:
set_var EASYRSA_REQ_COUNTRY "US"
set_var EASYRSA_REQ_PROVINCE "California"
set_var EASYRSA_REQ_CITY "San Francisco"
set_var EASYRSA_REQ_ORG "MyOrg"
set_var EASYRSA_REQ_EMAIL "admin@example.com"
set_var EASYRSA_REQ_OU "IT"
set_var EASYRSA_ALGO "ec"
set_var EASYRSA_CURVE "secp384r1"
Save (Ctrl+O, Enter, Ctrl+X).
Now build the CA:
Bash:
./easyrsa init-pki
./easyrsa build-ca
It will ask for a passphrase — choose a strong one. This secures your CA.
Step 5: Generate Server Certificates & Keys
Generate a certificate for your OpenVPN server:
Bash:
./easyrsa gen-req server nopass
Sign it:
Bash:
./easyrsa sign-req server server
Confirm with "yes" when prompted.
Generate Diffie-Hellman parameters (can take a few minutes):
Generate an HMAC key for TLS auth:
Bash:
openvpn --genkey --secret ta.key
Step 6: Copy Certificates to OpenVPN Directory
Bash:
cp pki/ca.crt pki/issued/server.crt pki/private/server.key ta.key pki/dh.pem /etc/openvpn/
Step 7: Configure OpenVPN Server
Create a config file:
Bash:
nano /etc/openvpn/server.conf
Paste this basic config:
Code:
port 1194
proto udp
dev tun
ca ca.crt
cert server.crt
key server.key
dh dh.pem
server 10.8.0.0 255.255.255.0
ifconfig-pool-persist ipp.txt
push "redirect-gateway def1 bypass-dhcp"
push "dhcp-option DNS 8.8.8.8"
push "dhcp-option DNS 8.8.4.4"
keepalive 10 120
tls-auth ta.key 0
cipher AES-256-CBC
auth SHA256
comp-lzo
user nobody
group nogroup
persist-key
persist-tun
status openvpn-status.log
verb 3
explicit-exit-notify 1

Note: You can change port to 443 (UDP or TCP) if you want to blend with HTTPS traffic.
Save and exit.
Step 8: Enable IP Forwarding
Edit sysctl config:
Uncomment or add:
Apply:
Step 9: Configure Firewall (UFW or iptables)
If using UFW:
Bash:
ufw allow 1194/udp
ufw allow OpenSSH
ufw enable
Add NAT rule:
Bash:
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
Make iptables rules persistent (optional, depends on distro).
Step 10: Start OpenVPN Service
Bash:
systemctl start openvpn@server
systemctl enable openvpn@server
Check status:
Bash:
systemctl status openvpn@server
Step 11: Generate Client Configs
Go back to your CA directory:
Generate a client key/cert:
Bash:
./easyrsa gen-req client1 nopass
./easyrsa sign-req client client1
Create a .ovpn file for your client:
Bash:
mkdir -p ~/client-configs/files
nano ~/client-configs/files/client1.ovpn
Paste this template:
Code:
client
dev tun
proto udp
remote YOUR_VPS_IP 1194
resolv-retry infinite
nobind
persist-key
persist-tun
remote-cert-tls server
cipher AES-256-CBC
auth SHA256
comp-lzo
verb 3
<ca>
(contents of /etc/openvpn/ca.crt)
</ca>
<cert>
(contents of /etc/openvpn/client1.crt)
</cert>
<key>
(contents of /etc/openvpn/client1.key)
</key>
<tls-auth>
(contents of /etc/openvpn/ta.key)
</tls-auth>
key-direction 1
Now copy each section (ca.crt, client1.crt, client1.key, ta.key) into their respective blocks.
You can use:
Bash:
cat /etc/openvpn/ca.crt
cat /etc/openvpn/client1.crt
cat /etc/openvpn/client1.key
cat /etc/openvpn/ta.key
Paste each inside its block in the .ovpn file.
Step 12: Transfer .ovpn File to Your Device
Use scp or download via secure method:
Bash:
scp ~/client-configs/files/client1.ovpn user@your_local_pc:~/Downloads/
Or use SFTP (FileZilla, WinSCP).
Then import the .ovpn file into:
- Windows: OpenVPN GUI
- Mac: Tunnelblick
- Android/iOS: OpenVPN Connect app
Do You Need to Buy SSL Certificates?
No. For OpenVPN, you
don’t need to buy SSL certificates.
- OpenVPN uses self-signed certificates managed by your own CA.
- The encryption is just as strong as commercial certs.
- Buying a public SSL cert (like from DigiCert) won't help here — OpenVPN doesn't use web-browser-trusted certs.

Exception: If you're running OpenVPN over
HTTPS (via web socket) or using
Captive Portal bypass, then Let’s Encrypt may be useful — but that's advanced.
For standard setup,
your self-signed CA is perfect and secure.
Security Tips
- Use strong passwords & firewall
- Change OpenVPN port to 443 (UDP) to bypass restrictive networks
- Disable unused clients
- Regularly update your VPS
Troubleshooting
- Can't connect? Check firewall, port, and systemctl status openvpn@server
- No internet through VPN? Verify IP forwarding and NAT rules
- Certificate errors? Double-check .ovpn file formatting
Bonus: Automated Script (Recommended!)
Instead of doing all this manually, use
PiVPN — an automated installer:
Bash:
curl -L https://install.pivpn.io | bash
It guides you through setup, generates configs, and handles updates.
https://pivpn.io
Let me know:
- Which OS you’re using (client side)?
- Whether you want TCP/UDP?
- If you’d like a script to automate client config generation?
Happy to help further!