安裝 EasyESA
cd && wget https://github.com/OpenVPN/easy-rsa/releases/download/v3.0.5/EasyRSA-nix-3.0.5.tgz tar xzf EasyRSA-nix-3.0.5.tgz cd ~/EasyRSA-3.0.5/ cp vars.example vars
cd && wget https://github.com/OpenVPN/easy-rsa/releases/download/v3.0.5/EasyRSA-nix-3.0.5.tgz tar xzf EasyRSA-nix-3.0.5.tgz cd ~/EasyRSA-3.0.5/ cp vars.example vars
yum install epel-release yum install -y openvpn
cp /usr/share/doc/openvpn-*/sample/sample-config-files/server.conf /etc/openvpn
push “redirect-gateway def1 bypass-dhcp” push “dhcp-option DNS 8.8.8.8” push “dhcp-option DNS 8.8.4.4” user nobody group nobody
cd ~ /usr/share/easy-rsa/3/easyrsa init-pki /usr/share/easy-rsa/3/easyrsa build-ca nopass /usr/share/easy-rsa/3/easyrsa gen-dh /usr/share/easy-rsa/3/easyrsa build-server-full vpn-server nopass /usr/share/easy-rsa/3/easyrsa build-client-full vpn-client-01 nopass /usr/share/easy-rsa/3/easyrsa gen-crl openvpn --genkey --secret pki/ta.key
cp pki/ca.crt /etc/openvpn/ca.crt cp pki/dh.pem /etc/openvpn/dh.pem cp pki/issued/vpn-server.crt /etc/openvpn/server.crt cp pki/private/vpn-server.key /etc/openvpn/server.key cp pki/ta.key /etc/openvpn/ta.key cp pki/crl.pem /etc/openvpn/crl.pem
cert server.crt key server.key dh dh.pem auth SHA256
systemctl -f enable openvpn@server.service systemctl start openvpn@server.service
tail -f /var/log/openvpn.log