How to Connect with OpenVPN using CLI on Debian-based Linux

This guide will show you how to setup OpenVPN using CLI quickly and easily :

STEP 1: Open your terminal window and install the OpenVPN package:

sudo apt install openvpn

STEP 2: Now change to the OpenVPN directory and download the config files:

cd /etc/openvpn
sudo wget

STEP 3: Unzip the downloaded config files:

sudo unzip

STEP 4 : Move all files to /etc/openvpn/

sudo cp /etc/openvpn/OpenVPN-Config/* /etc/openvpn/

STEP 5 : Rename the .ovpn config files to .conf, Example: server.ovpn to server.conf, run the below command to rename them all to .conf.

sudo rename -v 's/\.ovpn/\.conf/' *.ovpn

You may need to install the renamed package, you can do that doing the following:

sudo apt install rename

STEP 6: Connect to OpenVPN by running the below command on the config you wish to connect with:

sudo openvpn server.conf
Did this answer your question?