Skip to content
TrySitePrice

Install and Configure an OpenVPN on Debian 9 In 5 Minutes

Best/Tutorial

Here is a step by step guide to install and configure OpenVPN on Debian 9:

  1. Update the package index and install OpenVPN:

sudo apt-get update

sudo apt-get install openvpn

  1. Create a directory for the VPN configuration files:

sudo mkdir /etc/openvpn/server

  1. 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

  1. Unzip the configuration file:

sudo gzip -d /etc/openvpn/server/server.conf.gz

  1. Edit the OpenVPN configuration file, changing the following parameters:

sudo nano /etc/openvpn/server/server.conf

  • Replace local with the IP address of the server.
  • Replace port with the desired port number.
  • Replace proto with tcp or udp.
  • Replace dev tun with dev tun0.
  • Replace ca and cert with the paths to the respective files.
  • Replace key with the path to the key file.
  • Replace dh with the path to the DH file.
  • Uncomment the push "redirect-gateway def1 bypass-dhcp" line to redirect all client traffic through the VPN.
  1. Start the OpenVPN service:

sudo systemctl start openvpn@server

  1. Enable OpenVPN to start at boot:

sudo systemctl enable openvpn@server

  1. Verify that the OpenVPN service is running:

sudo systemctl status openvpn@server

This 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.