Securely set up and manage your VPN with this guide to configure OpenVPN Server on Ubuntu 20.04. Our DigitalOcean Support team is ready to assist you.
How to Install and Configure OpenVPN on Ubuntu 20.04
Setting up OpenVPN on Ubuntu 20.04 enables you to create a secure VPN, allowing private and remote connections. OpenVPN uses SSL/TLS certificates to ensure that data transferred between the server and connected clients remains encrypted and secure. This guide covers the process in simple steps, focusing on understanding the setup rather than overwhelming technical commands.
Prerequisites
Before beginning the installation, make sure your server meets certain requirements. You should have Ubuntu 20.04 LTS installed and a non-root user account with sudo privileges to perform administrative tasks safely. The server must be connected to the internet to download necessary packages and updates, and it is recommended to update all system packages before starting the OpenVPN installation. Additionally, note your server’s public IP address for client configuration, and ensure that your system time is accurate for certificate generation. Once the server is ready, you can also install an OpenVPN client on your devices to connect securely to the VPN server. For routing traffic through the VPN, enabling IP forwarding on the server is necessary.
Installing OpenVPN and EasyRSA
The first step in creating a VPN server on a cloud platform like Digital Ocean is installing OpenVPN and EasyRSA. OpenVPN provides the VPN framework, while EasyRSA generates SSL/TLS certificates, including the Certificate Authority (CA), server certificates, and client certificates. Setting up a CA is crucial because it signs both server and client certificates, ensuring that all connections remain encrypted and trusted. Once installed, EasyRSA initializes the public key infrastructure and prepares your environment for certificate creation. This setup forms the foundation for a secure Digital Ocean OpenVPN server.

Setting Up Server Certificates
After initializing the EasyRSA environment, you create a Certificate Authority to manage certificates. With the CA in place, the next step is generating server certificates and private keys. These certificates confirm the server’s identity to clients and establish a secure connection. You also generate Diffie-Hellman parameters, which are used to exchange encryption keys safely, and a TLS authentication key to protect the server from unauthorized connections or certain types of attacks. Finally, these certificates and keys are placed in the OpenVPN directory so the server can use them during operation.
Creating Client Certificates
Every client that connects to your OpenVPN server needs its own unique certificate and private key. These certificates are signed by the same CA used for the server, ensuring that all communications remain trusted and encrypted. Along with certificates, each client receives the CA certificate and a TLS key, which together authenticate and secure the connection. Proper distribution and configuration of these files are essential for maintaining the integrity and security of your VPN network.
Configuring and Running OpenVPN
Once the certificates have been generated, you configure the OpenVPN server to use them properly. First, update the server configuration file to reference the server certificate, key, CA certificate, and Diffie-Hellman parameters. Next, enable IP forwarding to allow VPN clients to access the internet, and apply NAT and firewall rules to secure network traffic. Finally, start the OpenVPN service and set it to launch automatically at boot, ensuring the VPN remains active and provides secure connections at all times.
[Need assistance with a different issue? Our team is available 24/7.]
Conclusion
Following the right steps ensures secure and reliable connections. This guide helps you configure OpenVPN Server on Ubuntu 20.04 efficiently.
In brief, our Support Experts demonstrated how to fix the “554 5.7.1 : Relay access denied” error.
