How to install VPN in Linux – Setup a VPN on Linux Ubuntu and Kali Linux


This guide explains the ways to install VPN in Linux using various methods in precise and straightforward manner.As I mostly use Kali Linux, my primary concentration would be on that. However, Kali Linux and Ubuntu use same Network Manager, so this guide applies to the any Debian variant such as Kali Linux, and Ubuntu variants such as Linux Mint, etc. In short, if you follow this guide, you will be able to install VPN in Linux (Kali Linux, Ubuntu, Debian Linux Mint, etc).(also see, 5 Best VPN for Linux 2018)

Get 70% off NordVPN (drops the price down to $3.49 per month)
(Discount is applied automatically)

How to install VPN in Linux – Setup a VPN on Linux Ubuntu and Kali Linux

Use a VPN’s Custom Linux Software

In many Operating Systems, the simplest way to set up a VPN is to utilize a VPN provider’s system software. This also valid in Linux, but several VPN providers give a custom Linux VPN client.

Actually, the only VPN service providers I know that offer Linux VPN clients with the full variety of features typically found in Windows and macOS software are AirVPN and Mullvad.

Setup a VPN on Linux Customer Software

AirVPN’s “Eddie” client supports a range of Linux configurations and is open source.

Install a VPN on Linux Customer Software

Mulvad’s client Linux supports Ubuntu/Debian, Fedora, Linux Elementary Freya and Arch Linux. It is also open source.

Install a VPN on Linux

ExpressVPN also proposes a custom Linux client, but it is command-line only and is not very fully-featured. It is possible for Ubuntu, Fedora, and Raspbian, but is not open source.

Install a VPN in Linux Ubuntu GNOME

The directions below all refer explicitly to Ubuntu and use Ubuntu’s graphic user interface (GUI). For directions using the Terminal command line or several versions of Linux, please see the specific VPNs’ websites.

1. Register an account with your chosen VPN provider.
2. Download its Debian software.

Downloading a VPN on Linux

3. When the .deb file gets downloaded, click it to open in Ubuntu’s Software Center. Then just click on install! Admin authentication will be needed.

VPN for Linux

Note that whatever Ubuntu’s Software Center states, both AirVPN and Mullvad’s clients are open source.

4. head to Show applications folder to launch the app. You will be asked to enter your account details.

Note that at time of writing Eddie needs a workaround for Ubuntu 17.10, but this will be settled when the next Eddie version is released.

OpenVPN For Linux via NetworkManager

Outward of dedicated clients, plausibly the simplest way to install and use OpenVPN on most Linux systems is via the NetworkManager daemon.

It is worth heeding that AirVPN suggests against using NetworkManager “due to various, critical issues.” I have not, however, been able to authenticate any more details about this, and most VPNs look happy to use it.

Installing OpenVPN in Ubuntu GNOME

1. Register an account with your preferred VPN provider.

2. Download your VPN provider’s .ovpn config files for servers you wish to connect to. These can often be batch-downloaded as a .zip file, in which case you will need to it unzip before employment.

In the past, NetworkManager did not prefer inline certificates and keys. Because of this, various VPNs support downloading them independently. But this no longer seems to be necessary.

3. Download and install the Ubuntu OpenVPN packages for NetworkManager by opening a Terminal window and typing:

sudo apt-get install network-manager-OpenVPN-gnome

4. Review that OpenVPN is accurately installed by clicking on the NetworkManager Icon in the notification session.

Installing a VPN on Ubuntu

Then go to VPN Off -> VPN Settings -> VPN -> and click the + button.

setup a VPN on Ubuntu

In the Add VPN box, you should see an OpenVPN option. If you don’t see OpenVPN, then restart your PC.

Install a VPN Ubuntu

5. Considering you see the OpenVPN choice, don’t click on it. Click on “Import from file…” instead. Drive to where you downloaded the .ovpn files and double-click on one.

Setting up a VPN for Ubuntu

6. An Add VPN box will seem populated by the server’s VPN settings. Just fill in your Username and Password and hit “Add”.

Install a VPN for Ubuntu

7. The VPN is now set up. Yay! To start it, go to NetworkManager -> VPN off -> and select the server you wish to connect to.

How to install a Ubuntu VPN

OpenVPN directly via the Linux Terminal

As a Linux user, I find nothing sexier than a blinking command-line curser! Yeah, baby! According to AirVPN, using OpenVPN via Linux Terminal is also more secure than using NetworkManager, although I have not been able to confirm this or uncover the details independently.(also see, Best VPN For Ubuntu- Enhance the Security of Your Linux OS by using a VPN)

Perversely, I cannot do a generic setup guide for this as the specifics change too much by VPN and by which quality of Linux you use. Most good providers, however, have directors.

Perceive that if using OpenVPN undeviatingly, DNS requests will not be shoved to the VPN provider’s DNS servers. IP leaks can be resolved by revising resolvconf to push DNS to your VPN’s DNS servers.

Alternatively, you can manually setup the iptables firewall to assure all traffic (including DNS requests) must go via the VPN server. This will, at least, secure all DNS requests are proxied by your VPN. It will also act as a kill switch.

The documentation on your VPN’s site may provide you further direction on these issues.

Manually Install VPN in Linux using PPTP via NetworkManager

PPTP is not a secure VPN protocol, so we suggest that you avoid it. NetworkManager comes with PPTP support “out of the box,” however, which can make PPTP a valuable “quick and dirty” solution when security is not a high preference.

1. Go to Network Manager -> VPN Settings. Click the + icon next to the VPN box -> Point-to-Point Tunneling Protocol (PPTP)

setting up a Ubuntu VPN

2. Fill in the PPTP setting given to you by your VPN. Note that these settings are not specific to Linux so that you can use generic settings, or the settings are given to another platform.

Add a VPN to Ubuntu Linux

Manually Install VPN in Linux using L2TP/IPsec

L2TP is a tunneling protocol that does not implement any encryption or confidentiality to data traffic that passes through it, so it is usually executed with the IPsec authentication suite (L2TP/IPsec).

How to install L2TP/IPsec for NetworkManager

NetworkManager-l2tp is a VPN plugin for NetworkManager 1.2+ which incorporates support for L2TP/IPsec.

To install, fire up Terminal and enter the following commands:

  1. sudo add-apt-repository ppa:nm-l2tp/network-manager-l2tp
  2. sudo apt-get update
  3. And sudo apt-get install network-manager-l2tp

You may be proposed to install addition binaries (e.g., for GNOME), in which case go forward. Restart your PC and L2TP should now be enabled in NetworkManager.

Installing a VPN L2TP PPTP


Setup is very comparable to using PPTP (see above), except that you will require entering some other IPSec authentication specifications. Again, your VPN should provide these, and generic settings are fine.


Setting up a VPN L2TP and IPsec

Manually Setup VPN for Linux by using IKEv2

IKEv2 is a fast and much secure VPN protocol that is swiftly gaining fame with VPN services. It is backed in Linux via strongSwan. strongSwan units are available for most variants of Linux, or you can build it yourself.

How to install IKEv2 for NetworkManager. You can develop this from source, or Debian/Ubuntu users can start terminal and enter:

sudo apt-get install network-manager-strongswan

In use, the plug-in serves just like the L2PT NetworkManager plug-in defined above.

Just type in the IKEv2 settings provided by your VPN (if it supports IKEv2).

Conclusion -How to install VPN in Linux

VPN is good, VPN is secure, VPN allows you to bypass proxies, Firewall, monitoring and content filtering. But there’s always that drama when you’re using VPN, sometimes it is slow and sometimes is not that secure you’d think. But for countries like Iran, Pakistan, Egypt, China, North Korea, etc. where internet content filtering is common on National Level maybe it’s a way to get the voice out. I am not going to address legality here so that I will leave that to you.


Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.