← Volver al blog

How to Set Up a VPN Server (OpenVPN)

  • Xernode
  • 1 min de lectura
  • 7 de abril de 2026
VPS security ubuntu vps openvpn vpn networking

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

  1. Update your package list
    • sudo apt update
  2. Install OpenVPN and Easy-RSA
    • sudo apt install -y openvpn easy-rsa
  3. Set up the Public Key Infrastructure (PKI)
    • make-cadir ~/openvpn-ca
    • cd ~/openvpn-ca
  4. Configure Easy-RSA variables and build the CA
    • source vars
    • ./clean-all
    • ./build-ca
  5. Generate server and client certificates
    • ./build-key-server server
    • ./build-key client
    • ./build-dh
    • openvpn --genkey --secret keys/ta.key
  6. Copy server files and start OpenVPN
    • sudo cp -r keys /etc/openvpn
    • sudo systemctl start openvpn@server
    • sudo systemctl enable openvpn@server
  7. (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