×


How to Set Up OpenVPN Server on Debian 10 ?

Do you need to set up an OpenVPN Server on Debian Linux version 10 server to protect your browsing activity from attackers on public Wi-Fi? This guide will show you how.

OpenVPN is a sophisticated SSL VPN (virtual private network) by means of which you can connect securely to an insecure public network such as WIFI network at the airport or hotel. 

Here at LinuxAPT, as part of our Server Management Services, we regularly help our Customers to perform Software Installation tasks on their Debian Linux Servers.

In this context, we shall look into how to configure an OpenVPN server on Debian Linux 10 server.


More about VPN and how to set up OpenVPN Server on Debian?

VPN aims to protect the Server environment from bad actors trying to attach the system. It is essential in order to access corporate, enterprise or home server resources. With OpenVPN, you can bypass the geo-blocked site and increase your privacy or safety online.

Start by logging into to Server via an ssh tool such as putty and once logged in,  update and upgrade the system packages by running the following apt commands;

sudo apt update
sudo apt upgrade


Then follow the following steps to set up OpenVPN Server.


1. Finding and Taking Note of your Server IP address

With the ip command, you can find your ip address by running the following commands;

ip a
ip a show eth0


Alternatively, you can use the dig command to get your public IP address as shown below;

dig +short myip.opendns.com @resolver1.opendns.com

OR

dig TXT +short o-o.myaddr.l.google.com @ns1.google.com | awk -F'"' '{ print $2}'


2. How to download and run OpenVPN  on Debian?

To download OpenVPN, you can use the its script "debian10-vpn.sh". To do this, run the wget command as shown below;

wget https://raw.githubusercontent.com/Angristan/openvpn-install/master/openvpn-install.sh -O debian10-vpn.sh

Next, set permission on the downloaded script by running the chmod command as seen below;

chmod +x debian10-vpn.sh

To view the contents of this script, you can use the System text editor (vi or vim) as shown below;

vi debian10-vpn.sh


Now to run the "debian10-vpn.sh" script which will enable the installation of OpenVPN server, run the command shown below;

sudo ./debian10-vpn.sh

Then, you will prompted to enter your server information such as the IP address, IPv6 support for NAT (y), Port to listen to (1194), Protocol (UDP), DNS (Cloudflare), Compression (y), Encryption settings customization (n), and then press any key to complete the process.

Ensure that you always use Google DNS or 1.1.1.1 as they are very reliable and fast.


3. How to start, stop, and restart OpenVPN server on Debian 10 ?

To stop openvpn server, run the following command;

sudo systemctl stop openvpn@server 

To start openvpn server, run the following command;

sudo systemctl start openvpn@server 

To restart openvpn server, run the following command;

sudo systemctl restart openvpn@server  

To check the status of openvpn server, run the following command;

sudo systemctl status openvpn@server 


4. How to Add, delete and revoke VPN users?

Since OpenVPN is installed and running successfully, you can now add a new user or delete existing VPN users. We can do this simply by running the debian10-vpn.sh script again. 

To do this, run the following command;

sudo ./debian10-vpn.sh


Need support in setting up OpenVPN on Debian Server? We are available to help you today.


Conclusion

This article will guide you on how to set up an OpenVPN server on Debian Linux 10 server.