How to install OpenVPN Server on Debian 9

Debian Tutorial – This tutorial is going to show you how to install OpenVPN on Debian 9 Stretch. OpenVPN is a great solution that provide a secure connection over the internet. The VPN (Virtual Private Network) can protect you from the bad guy when you connected to public WiFi or else.

On this example, I have a droplet (virtual server) at DigitalOcean. You may also power up a small droplet like mine with $5 per month. Make a note the public IP address of the droplet. We will use the IP address of the droplet on this tutorial. For example, your public IP is :

Steps to install OpenVPN on Debian 9

Step 1. Get the Public IP address

In DigitalOcean dashboard, you can see current IP address of the droplet easily.

Step 2. Update and Upgrade Debian

Make sure your system is up to date.

Step 3. Install and configure UFW (Uncomplicated Firewall)

We need to install and configure the UFW on Debian 9. Its pretty easy.

Install UFW

Configure ufw to enable some important ports


At this point ufw is up and running and access to port 80, 442 and 22 is enabled.

Step 4. Download install script

Step 5. Run the install script

You will be asked to enter your IP address, port etc. Please make sure you change the IP address with your Public IP address.
The installation process will take place. It took some times so be patient. At this point, our OpenVPN Server is ready. You can now check firewall rule
How to start, stop and check status of the OpenVPN Server Service
Download the configuration file

Now we can download the ovpn configuration file. This file will be used to connect to the server. We can use scp command to do this

scp root@ /home/dhani/Desktop

Change the details above with your own.

Leave a Reply

Your email address will not be published.