OpenVPN is a powerful open-source solution for creating a private VPN server. In this guide, we've walked through the process of installing and configuring an OpenVPN server on DigitalOcean's cloud service. With an OpenVPN server, you can secure your internet connection and securely access a virtual private network from anywhere.
ssh root@your_droplet_ip
apt update apt upgrade
apt install openvpn easy-rsa
make-cadir ~/openvpn-ca cd ~/openvpn-ca
source vars
./clean-all ./build-ca
./build-key-server server
openvpn --genkey --secret keys/ta.key
Create a configuration file for the OpenVPN server. You can use the following
sample configuration as a starting point (server.conf
):
proto udp dev tun ca /etc/openvpn/easy-rsa/keys/ca.crt cert /etc/openvpn/easy-rsa/keys/server.crt key /etc/openvpn/easy-rsa/keys/server.key dh /etc/openvpn/easy-rsa/keys/dh2048.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 /etc/openvpn/easy-rsa/keys/ta.key 0 cipher AES-256-CBC comp-lzo user nobody group nogroup persist-key persist-tun status openvpn-status.log verb 3
Start the OpenVPN service using the following command:
systemctl start openvpn-server@server.service
Enable OpenVPN to start on boot:
systemctl enable openvpn-server@server.service
By following the steps outlined in this guide, you've successfully set up an OpenVPN server on DigitalOcean. This server allows you to create a secure and private VPN, giving you the ability to protect your internet connection and access a virtual private network from anywhere. You can now further configure your OpenVPN server and connect to it from your devices to enjoy a secure online experience.