We're here to assist with any of your needs, don't hestitate to reach out.
OpenVPN is an open-source virtual private network (VPN) application that allows you to create secure and encrypted connections between multiple devices over the internet. It provides a secure way to access network resources remotely and ensures the privacy and confidentiality of data transmitted over the network.
Here are the steps to install OpenVPN on CentOS 7:
$ sudo yum update
$ sudo yum install epel-release
$ sudo yum install openvpn easy-rsa
$ sudo mkdir /etc/openvpn
$ sudo mkdir /etc/openvpn/easy-rsa
$ cp -r /usr/share/easy-rsa/3.0/* /etc/openvpn/easy-rsa
$ sudo vi /etc/openvpn/easy-rsa/vars
Modify the variables according to your requirements. For example, you can change the country, organization, and email address.
$ sudo -i
$ cd /etc/openvpn/easy-rsa
$ source ./vars
$ ./easyrsa init-pki
Follow the on-screen instructions to initialize the PKI.
$ ./easyrsa build-ca
You will be prompted to enter a common name for your CA. Press Enter to use the default name.
$ ./easyrsa gen-req server nopass
$ ./easyrsa sign-req server server
You will be prompted to enter a password for the server certificate. Press Enter to leave it blank.
$ ./easyrsa gen-dh
$ sudo cp /etc/openvpn/easy-rsa/pki/ca.crt /etc/openvpn/
$ sudo cp /etc/openvpn/easy-rsa/pki/issued/server.crt /etc/openvpn/
$ sudo cp /etc/openvpn/easy-rsa/pki/private/server.key /etc/openvpn/
$ sudo cp /etc/openvpn/easy-rsa/pki/dh.pem /etc/openvpn/
$ sudo vi /etc/openvpn/server.conf
Add the following content to the file (you can modify it according to your requirements):
proto udp ;proto tcp dev tun user nobody group nobody persist-key persist-tun ca ca.crt cert server.crt key server.key dh dh.pem server 10.8.0.0 255.255.255.0 ifconfig-pool-persist ipp.txt push "redirect-gateway def1 bypass-dhcp" push "dhcp-option DNS 8.8.8.8" push "dhcp-option DNS 8.8.4.4" keepalive 10 120 tls-auth ta.key 0 cipher AES-256-CBC auth SHA256 comp-lzo max-clients 10 user nobody status openvpn-status.log verb 4
$ sudo firewall-cmd --add-service=openvpn --permanent
$ sudo firewall-cmd --reload
$ sudo systemctl enable [email protected]
$ sudo systemctl start [email protected]
$ sudo systemctl status [email protected]
Congratulations! OpenVPN has been successfully installed on your CentOS 7 server. You can now configure your client devices to connect to the VPN server using the generated keys and certificates.
Remember to secure your OpenVPN server by adjusting firewall rules and implementing additional security measures as needed.
What our customers say about us
Create your free account today.