How to Set Up a VPN Server (OpenVPN)
Introduction
Setting up a VPN server on your VPS helps secure your internet traffic and access resources remotely. This guide explains how to install and configure OpenVPN on Ubuntu.
Step-by-step Guide
- Update your package list
- sudo apt update
- Install OpenVPN and Easy-RSA
- sudo apt install -y openvpn easy-rsa
- Set up the Public Key Infrastructure (PKI)
- make-cadir ~/openvpn-ca
- cd ~/openvpn-ca
- Configure Easy-RSA variables and build the CA
- source vars
- ./clean-all
- ./build-ca
- Generate server and client certificates
- ./build-key-server server
- ./build-key client
- ./build-dh
- openvpn --genkey --secret keys/ta.key
- Copy server files and start OpenVPN
- sudo cp -r keys /etc/openvpn
- sudo systemctl start openvpn@server
- sudo systemctl enable openvpn@server
- (Optional) Allow VPN traffic through the firewall
- sudo ufw allow 1194/udp
- sudo ufw allow OpenSSH
- sudo ufw enable
Recommendations
- Always use strong passwords for your certificates and keys.
- Regularly update OpenVPN and your server.
- Backup your configuration and keys securely.
Call To Action
eed a secure VPS for your VPN server? Explore our hosting plans: https://xernode.com/#pricing
Related Guides
- How to Enable Firewall (UFW) in Ubuntu
- How to Set Up a Static IP in Linux
- How to Secure Your VPS with Fail2Ban