Setting up an OpenVPN server on CentOS 8 can be done in just a few minutes using the following steps:
sudo dnf install openvpn
/etc/openvpn
directory:sudo cp /usr/share/doc/openvpn-*/sample/sample-config-files/* /etc/openvpn
server.conf
:sudo mv /etc/openvpn/server.conf.sample /etc/openvpn/server.conf
server.conf
file and configure the OpenVPN server settings. At a minimum, you will need to set the local
and proto
options. For example:local 192.168.1.100 proto udp
sudo bash -c 'umask 077; /usr/share/openvpn/easy-rsa/easyrsa init-pki; /usr/share/openvpn/easy-rsa/easyrsa build-ca nopass; /usr/share/openvpn/easy-rsa/easyrsa gen-req server nopass; /usr/share/openvpn/easy-rsa/easyrsa sign-req server server; /usr/share/openvpn/easy-rsa/easyrsa gen-dh'
/etc/openvpn
directory:sudo cp /usr/share/openvpn/easy-rsa/pki/ca.crt /usr/share/openvpn/easy-rsa/pki/private/server.key /usr/share/openvpn/easy-rsa/pki/issued/server.crt /etc/openvpn
sudo systemctl enable --now openvpn@server
sudo firewall-cmd --add-service=openvpn --permanent sudo firewall-cmd --reload
That's it! Your OpenVPN server should now be up and running. You can create client configuration files using the instructions in the /usr/share/doc/openvpn/README.fedora
file, or by following the official OpenVPN documentation.
Note: These instructions are intended as a basic guide for setting up an OpenVPN server on CentOS 8. For a more secure and robust OpenVPN setup, you should consider using additional security measures such as certificate authentication, firewall rules, and seccomp filters.