Skip to content
TrySitePrice

How To Set up OpenVPN Server In 5 Minutes on Ubuntu Linux

Best/Tutorial

Here are the steps to set up an OpenVPN server on Ubuntu Linux in 5 minutes:

  1. Install OpenVPN:

sudo apt-get update

sudo apt-get install openvpn easy-rsa

  1. Copy the sample OpenVPN configuration files:

sudo cp /usr/share/doc/openvpn/examples/sample-config-files/server.conf.gz /etc/openvpn/

sudo gzip -d /etc/openvpn/server.conf.gz

  1. Modify the OpenVPN configuration file:

sudo nano /etc/openvpn/server.conf

  • Change the proto setting to udp or tcp depending on your desired protocol.
  • Change the port setting to the desired port number.
  • Change the dev tun setting to dev tap if you want to use TAP mode instead of TUN mode.
  • Change the server setting to specify the subnet for the virtual network.
  • Uncomment the push "redirect-gateway def1 bypass-dhcp" line to enable client-side routing.
  1. Generate the SSL certificate and key:

sudo make-ccd-keys

  1. Start the OpenVPN server:

sudo systemctl start openvpn@server

  1. Enable the OpenVPN server to start automatically on boot:

sudo systemctl enable openvpn@server

That's it! Your OpenVPN server is now up and running. You can now create client configuration files and connect to the server.