How can we help you today?
title-mark

How to set up OpenVPN in Ubuntu?

To set up an OpenVPN server in Ubuntu, you can follow these steps:

  • Update your system

Run these commands to ensure your system is up-to-date:

sudo apt update && sudo apt upgrade -y

  • Download the installation script

Use this script to automate the setup:

wget https://git.io/vpn -O openvpn-install.sh

chmod +x openvpn-install.sh

  • Run the script

Execute the script with root privileges:

sudo ./openvpn-install.sh

  1. Select UDP (recommended).
  2. Keep the default port (1194).
  3. Choose a DNS provider (e.g., Cloudflare or Google).
  4. Name your client (e.g., myvpn).
  • Finish setup

The script generates a .ovpn client file (e.g., /root/myvpn.ovpn). Transfer this file to your devices to connect to the VPN.

  • Manage the service

Start/Stop OpenVPN:

sudo systemctl start openvpn-server@server.service

sudo systemctl stop openvpn-server@server.service

Check status:

sudo systemctl status openvpn-server@server.service