installopenvpn
Install an OpenVPN server on AlmaLinux (Easy-RSA certificates, firewalld rules, IP forwarding) and create a ready-to-use client .ovpn file
- Command:
/go/installopenvpn - Category: Network
- Required option: None
- Output: Progress messages, a few prompts, and the path of the client file
- Last updated: 2026-11-20
On this page: Overview · Quick start · Syntax · Options · Output · Examples · Troubleshooting · Details · See also
Overview
/go/installopenvpn turns the server into a VPN server. When it finishes, you can connect from a laptop or phone with the OpenVPN client, and all of the client's internet traffic goes out through this server.
In one run it:
- installs OpenVPN and Easy-RSA
- builds a certificate authority, a server certificate, Diffie-Hellman parameters, and a TLS key
- writes the OpenVPN server configuration
- enables IP forwarding and configures firewalld
- starts and enables the
openvpn-server@serverservice - creates one client, named
config, and saves its connection file as/usr/local/goadmio/home/go/vpn/config.ovpn
[!WARNING] Read these two points before you run it:
- The script turns on firewalld. On a GoAdmio server that already has its own firewall, firewalld's default rules can block the websites, mail, panel, or even SSH, and the two firewalls can conflict. See Troubleshooting.
- The client file contains a private key and is saved inside GoAdmio's panel folder. Download it and delete it from the server. See Security notes.
Quick start
# Run as root
/go/installopenvpn
Answer the prompts as described in Output. When it finishes, download config.ovpn and import it into your OpenVPN client.
Syntax
/go/installopenvpn
The command takes no arguments. It must be run as root. It does not switch to sudo by itself.
Options
There are no command-line options. To change the settings, edit the variables at the top of the script before you run it:
| Variable | Default | Notes |
|---|---|---|
SERVER_IP |
Empty (detected automatically) | The public address clients connect to. Set it if the detection is wrong, for example behind NAT. |
OPENVPN_PORT |
1194 |
The port the server listens on. |
OPENVPN_PROTOCOL |
udp |
udp or tcp. |
CLIENT_NAME |
config |
The name of the first client and of its .ovpn file. |
Fixed in the script: the VPN subnet is 10.8.0.0/24, clients get Google's DNS servers (8.8.8.8 and 8.8.4.4), and all client traffic is sent through the VPN.
Output
The command prints a heading for each step (--- Installing OpenVPN, Easy-RSA, --- Setting up Easy-RSA PKI ---, and so on).
It is not fully unattended. Easy-RSA stops and asks you to:
- press Enter to accept the Common Name of the certificate authority
- press Enter to accept the Common Name of the server request
- type
yesto confirm signing the server certificate
If the server's public IP can't be detected, it also asks you to type it.
Generating the Diffie-Hellman parameters can take several minutes.
At the end it prints:
OpenVPN client configuration file '/usr/local/goadmio/home/go/vpn/config.ovpn' created successfully.
--- OpenVPN server and client setup finished ---
| Outcome | What you get |
|---|---|
| Success | The messages above. |
| A step fails | Error: ... and exit status 1. Nothing is rolled back. |
| Not run as root | This script must be run as root or with sudo. Exit status 1. |
Every run is logged to /var/log/go/installopenvpn.log with a timestamp and the arguments used.
Examples
# Install the server and create the first client
/go/installopenvpn
# Check the service afterwards
systemctl status openvpn-server@server
# Connect from a Linux client with the saved file
sudo openvpn --config config.ovpn
# Create another client (no helper is included for this)
cd /etc/openvpn/easy-rsa
./easyrsa build-client-full laptop nopass
The last example only creates the certificate and key. You have to build the .ovpn file for that client yourself, using config.ovpn as a template.
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
No match for argument: openvpn |
The package comes from the EPEL repository, which isn't enabled. | Run dnf install epel-release, then run the command again. |
cp: cannot stat '/usr/share/easy-rsa/3.2.1/*' and Failed to initialize PKI |
The Easy-RSA version path is fixed in the script, and your version is different. | Look in /usr/share/easy-rsa/ for the real version and change the path in the script. |
| The command waits and does nothing | Easy-RSA is waiting for input, or the Diffie-Hellman parameters are being generated. | Press Enter or type yes when asked. Otherwise wait. |
| Websites, mail, or the panel stopped working | firewalld was started with its default rules and is now blocking traffic. |
Open the needed ports in firewalld, or turn it off and use the GoAdmio firewall. Check with checkfirewall and see firewall. |
| You are locked out of SSH | SSH runs on a port other than 22, and firewalld only allows the standard SSH service. |
Use the provider's console and add the port, for example firewall-cmd --permanent --add-port=<port>/tcp, then firewall-cmd --reload. |
Error: Failed to start OpenVPN service |
A problem in the configuration, a busy port, or a missing TUN device. | Run journalctl -xeu openvpn-server@server.service. |
Cannot open TUN/TAP dev /dev/net/tun |
The server is a container or VPS without TUN support. | Enable TUN/TAP in your provider's panel. |
The service fails because of comp-lzo |
comp-lzo is deprecated, and newer OpenVPN versions can refuse it. |
Remove comp-lzo from /etc/openvpn/server/server.conf and from the client file, then restart the service. |
| The client connects but has no internet | IP forwarding or masquerading isn't active. | Check sysctl net.ipv4.ip_forward (should be 1) and firewall-cmd --list-all. |
| The client can't connect | The port is blocked by the provider or an external firewall, or SERVER_IP is wrong. |
Open the port at the provider. Check the remote line in the client file. |
| The client points to the wrong address | The address detection returned a different IP (for example, behind NAT). | Set SERVER_IP in the script, or change the remote line in the client file. |
| Running it a second time breaks existing clients | init-pki removes the old PKI, so a new certificate authority is created. |
Don't run it twice. Back up /etc/openvpn/easy-rsa first. |
Details
Steps
| # | What it does |
|---|---|
| 1 | Checks for root. |
| 2 | Installs openvpn and easy-rsa with dnf. |
| 3 | Finds the public IP with ifconfig.me, or asks for it. |
| 4 | Copies Easy-RSA to /etc/openvpn/easy-rsa, runs init-pki, and builds the CA without a passphrase. |
| 5 | Creates and signs the server certificate, generates the Diffie-Hellman parameters, and creates the TLS key ta.key. |
| 6 | Copies the keys to /etc/openvpn/server and writes server.conf. |
| 7 | Turns on IP forwarding in /etc/sysctl.d/99-openvpn-forwarding.conf. |
| 8 | Enables firewalld, opens the VPN port, and turns on masquerading for 10.8.0.0/24. |
| 9 | Starts and enables openvpn-server@server. |
| 10 | Creates the client certificate and the .ovpn file. |
| 11 | Enables and restarts the service once more. |
Server settings
server.conf sets the port and protocol, a 10.8.0.0/24 VPN subnet, AES-256-CBC encryption with SHA256, a TLS-auth key, keepalive 10 120, and compression with comp-lzo. It pushes redirect-gateway def1 bypass-dhcp and the two Google DNS servers to every client. The client file repeats these settings and contains the certificates and keys inline.
Files and requirements
| Item | Used for |
|---|---|
/etc/openvpn/easy-rsa |
The certificate authority, including its private key (without a passphrase). |
/etc/openvpn/server |
server.conf, ca.crt, server.crt, server.key, dh.pem, ta.key. |
/etc/sysctl.d/99-openvpn-forwarding.conf |
IP forwarding. |
/usr/local/goadmio/home/go/vpn/config.ovpn |
The client file. |
openvpn-server@server |
The systemd service. |
/var/log/go/installopenvpn.log |
The command log. |
AlmaLinux (dnf, firewalld), internet access |
The script doesn't check the OS. It only works on systems with these tools. |
Security notes
config.ovpncontains the client's private key. Anyone who gets the file can connect to your VPN. It is saved in the GoAdmio panel's folder, so make sure that folder isn't downloadable by others, download the file at once, and delete it from the server.- The CA key, the server key, and the client key have no passphrase.
server.confhas no certificate revocation list (crl-verify), so revoking a client certificate in Easy-RSA doesn't stop it from connecting.- Compression with encryption (
comp-lzo) is generally discouraged for security reasons. - Every client's traffic leaves through this server, so it uses this server's bandwidth. Check your provider's terms.
See also
| Command | Description |
|---|---|
firewall |
Install a firewall on a GoAdmio server |
checkfirewall |
Verify that important required ports are open on your server |
allow |
Open a port in your server's firewall |
deny |
Block incoming traffic on a TCP port |
port |
Change the default SSH port (22) to another port |
ipv6 |
Enable, disable, or configure IPv6 on the server |
proxmox |
Install Proxmox VE |
xrdp |
Install xRDP on a GoAdmio server |