Install and Configure an OpenVPN on Debian 9 In 5 Minutes
Here is a step by step guide to install and configure OpenVPN on Debian 9:
- Update the package index and install OpenVPN:
sudo apt-get update
sudo apt-get install openvpn- Create a directory for the VPN configuration files:
sudo mkdir /etc/openvpn/server- Copy the sample OpenVPN server configuration file to the new directory:
sudo cp /usr/share/doc/openvpn/examples/sample-config-files/server.conf.gz /etc/openvpn/server- Unzip the configuration file:
sudo gzip -d /etc/openvpn/server/server.conf.gz- Edit the OpenVPN configuration file, changing the following parameters:
sudo nano /etc/openvpn/server/server.conf- Replace
localwith the IP address of the server. - Replace
portwith the desired port number. - Replace
protowithtcporudp. - Replace
dev tunwithdev tun0. - Replace
caandcertwith the paths to the respective files. - Replace
keywith the path to the key file. - Replace
dhwith the path to the DH file. - Uncomment the
push "redirect-gateway def1 bypass-dhcp"line to redirect all client traffic through the VPN.
- Start the OpenVPN service:
sudo systemctl start openvpn@server- Enable OpenVPN to start at boot:
sudo systemctl enable openvpn@server- Verify that the OpenVPN service is running:
sudo systemctl status openvpn@serverThis should get you started with OpenVPN on Debian 9. However, this is a simplified example and you may need to add additional security measures, such as setting up a firewall, to meet your specific requirements.
