How to Install a VPN on Linux

Easily connect from your desktop

Ubuntu with VPN connection

You can connect to nearly any VPN service from Linux, but the process isn’t always the same. Each provider has their own offerings and configurations. Some providers specialized Linux clients. Almost all of them provide OpenVPN configurations that you can use to connect either graphically through Network Manager on your desktop or as a system service. The service route is fairly technical and doesn’t offer many benefits over the graphical route, so this guide covers only Network Manager.

Use The Client

Before you dig in and try to set things up with OpenVPN, it’s worth checking to see if your VPN service offers a Linux client. Client programs offer features that a simple OpenVPN configuration can’t. If you want built-in features like a VPN kill switch, automatic server switching, and other leak prevention features, turn to your VPN client first.

Major VPN services like NordVPN, ExpressVPN, and Private Internet Access all offer Linux clients. Take a look at your VPN service’s website to see if they offer one too. You can almost always download a package from them and install it from the command line. That said, most support Debian distributions, like Ubuntu and Mint and Red Hat distributions, like Fedora and CentOS. Some only have Debian packages. Make sure that your distribution is supported.

You can install the package with a command similar to one of these:


$ sudo dpkg -i expressvpn_2.1.0-1_amd64.deb


$ sudo dnf install expressvpn_2.1.0-1_amd64.rpm

Connecting Graphically With Network Manager

The easiest way to set up a VPN connection on Linux is using Network Manager. Network Manager is the graphical network connection applet found in almost every Linux desktop environment. If you’ve ever connected to Wi-Fi from your Linux desktop, you used Network Manager to set it up.

Network Manager connections can run on login, and you can manage multiple VPNs graphically, without the need to open an application or even a configuration window.

Install the Packages

Like with anything on Linux, there are packages that you need to install. If you have a graphical desktop, you have Network Manager, but you’ll need OpenVPN and the plugin to hook in to the Network Manager applet.

Ubuntu, Debian, Linux Mint, and Derivatives

$ sudo apt install openvpn network-manager-openvpn

If you’re on GNOME or some GTK desktops like Cinnamon and MATE, also run:

$ sudo apt install network-manager-openvpn-gnome

Fedora/CentOS and RHEL 8

$ sudo dnf install openvpn networkmanager-openvpn

If you’re using GNOME or another GTK desktop like Cinnamon or MATE, also run:

$ sudo dnf install networkmanager-openvpn-gnome

Arch Linux, Manjaro, and Derivatives

# pacman -S openvpn networkmanager-openvpn


$ sudo zypper install openvpn NetworkManager-openvpn

For Plasma specific support:

$ sudo zypper install plasma-nm5-openvpn

Download the OpenVPN Configurations

Almost every VPN service provides ready-made OpenVPN configuration files for download. Because OpenVPN is an open source project, and a nearly universal standard throughout the VPN world, those configuration files cover most devices not directly supported by the provider. More often than not, when a VPN says they provide support for devices, like routers, they’re talking about OpenVPN support.

To get your OpenVPN configurations, sign in to your VPN account, and look in your account control panel for Linux support or something directly mentioning OpenVPN files. Every service is different, so it’s impossible to say here exactly where they’ll be.

If you’re having a hard time, a Google search is one of your better options. Usually, the download page you want will be one of the first results.

When all else fails, contact your VPN service’s support. They’ll either get the configurations for you or a direct link to them.

The files will probably come in a ZIP archive. It won’t be very large — they’re just text files — so it won’t take much time. Unpack the ZIP someplace convenient, and you’ll be ready to set up your first VPN connection.

Connect With Network Manager on GNOME

GNOME is easily the most popular Linux desktop environment. It’s the default choice of many major distributions, including Ubuntu, Fedora, and Debian. If you’re running one of those, and you didn’t choose a different desktop environment, GNOME is what’s on your computer.  

  1. Locate the network manager applet in your system tray. It’s in the upper right corner of the screen by default. You can select anywhere in the area to show the menu.

  2. From the menu, choose Wired Settings or Wireless Settings, depending on how you’re connected.

    Ubuntu GNOME connections.
  3. That opens Settings and takes you directly to the Network tab. Find the VPN heading, and click the plus sign icon (+).

    Ubuntu GNOME VPN option in Network settings.
  4. A new smaller window will pop open for you to select the type of VPN connection to create. Choose Import from file.

    Ubuntu GNOME add VPN connection.
  5. Another window will open, letting your browse to your .ovpn configuration file. Find the one you want to set up, and Open it.

    Ubuntu GNOME browse to VPN configuration
  6. A configuration window opens to set up your new connection. Everything you need to connect to the VPN is already filled in, with the exception of your User Name and Password. Fill those in, and click Add in the upper-right corner of the window.  

    Ubuntu GNOME Add VPN configuration
  7. The configuration window closes, and you’ll return to the network settings. This time, you’ll find your VPN listed under the VPN heading. Flip the switch next to it to activate the connection.

    The On/Off switch for the Ubuntu GNOME VPN connection.

Connect on Most Other GTK Desktops

If you're not using GNOME, but you are on one of the other popular GTK desktops, like Cinnamon, XFCE, or MATE, follow these instructions to get connected.

  1. Locate the Network Manager applet icon in your desktop’s system tray. It’s probably either going to be the standard Wi-Fi icon, a picture of a network cable, or two computers connected. Those are the most common ones, but if you’re using a custom icon theme, it could be something different.

  2.  Right click the icon to reveal a management menu.

  3.  From that new menu, select Edit Connections.

    The Edit Connections menu in Linux.
  4. A new Network Connections window opens, listing the current connections on your system. In the bottom left of the window, you’ll find a plus sign ( + ), a minus sign ( - ), and a gear. Click the plus icon.

    Linux edit network connections.
  5. Another new window will open for you to select the type of connection you want to create. Scroll all the way to the bottom, and choose Import a saved VPN connection. Then, select Create.

    Linux NetworkManager import VPN configuration.
  6. A Browse window will open up for you to locate one of your OpenVPN configuration files. Browse to your files, select one, and Open it.

  7. You’ll get a new window to set up your connection. Everything you need will already be filled in. Network Manager reads the configuration file, and plugs in everything your VPN service provided. The only thing it needs from you is your login information. Enter your VPN User name and Password in the form.

    Linux Edit VPN connection info.
  8.  When you’re done, press Save in the lower right of the window.

  9. The top configuration window will close, and show you the updated list of connections. Take a look to make sure that your new connection is there.

  10. Now, turn your attention back to the Network Manager applet icon. Select it to reveal the available connections. Mouse over VPN Connections to show the available VPNs.

    Linux connect to VPN Network Manager.
  11. Select your VPN from the list. As soon as the check appears next to the connection name, your computer will start trying to connect. When it’s successful, you’ll see a notification appear to let you know that you’re connected.

Automatically Connect to Your VPN

If you want to automatically connect to your VPN whenever your Internet connection is active, you can set that up through Network Manager too.

  1. If you’re on a GTK desktop other than GNOME, right click the Network Manager applet icon again.

    GNOME users are going to need to get there another way. Open a terminal window, and run:

    $ nm-connection-editor

    Then Gnome users can skip to step 3.

  2.  Select Edit Connections from the menu

  3. The same Network Connections window from before will open up. Select your regular Internet connection from the list, and press the gear icon.

  4. A new window will open for your connection. It should look similar to the one you used to set up the VPN. Select the General tab at the top of the window.

    Linux connect automatically to VPN
  5. Select Automatically connect to VPN.

  6. Use the drop down menu to the right to choose the VPN server you want to connect to automatically.

  7. When everything looks good, select Save in the bottom right of the window.