Your IP: Unknown · Your Status: ProtectedUnprotectedUnknown

Skip to main content

How to set up a VPN on Linux in 3 easy ways

Even a secure operating system like Linux can take advantage of the benefits provided by a virtual private network (VPN), so it’s a good idea to set up a VPN on your Linux device. But why do you need a VPN on Linux, and how do you install it? Let’s find out.

How to set up a VPN on Linux in 3 easy ways

Table of Contents

Table of Contents

Why do you need a VPN for Linux?

Reasons to set up a VPN are the same no matter which OS you use – VPN security and privacy benefits apply to Linux, Windows, Android, and other operating systems.

Secure your internet connection and enhance your privacy with a VPN.


Get NordVPN

What do you need for a Linux VPN setup?

For a successful Linux VPN setup, you’ll need:

  • Computer (especially Linux) skills and the understanding of what a VPN is
  • A device running Linux. NordVPN supports most Debian-based and RHEL-based systems
  • Sudo (administrator) privileges and the root password
  • An active VPN subscription
  • OpenVPN configuration files (if you decide to use the OpenVPN app or Network Manager for the setup)

You can also change your DNS settings and check for DNS leaks beforehand.

And don’t forget that configuration interfaces and thus instructions may differ depending on which Linux distribution you have.

How to set up a VPN on Linux

When you have everything you need, you have a few ways to set up a VPN on a Linux device:

  • installing a VPN client
  • installing the OpenVPN application
  • adding OpenVPN configuration in the Network Manager

How to set up a VPN on Linux with the VPN client

If your VPN provider has a native application for Linux, installing it is the simplest way to set up a VPN on Linux.

NordVPN’s client works on Debian, Ubuntu, Raspberry Pi computers, Elementary OS, and Linux Mint. Setting it up is pretty straightforward:

  1. Download the NordVPN configuration package.
  2. Open “Terminal” and type in the following command to install the NordVPN repository on your system:
    sudo apt-get install /pathToFile/nordvpn-release_1.0.0_all.deb
    You’ll need to replace “pathToFile” with the location of the NordVPN package that you’ve just downloaded. If it ended up in the “Downloads” folder, the command would look like this:
    sudo apt-get install ~/Downloads/nordvpn-release_1.0.0_all.debLinux VPN setup: step 1
  3. Type in your password to begin the installation.
  4. Once the installation finishes, update the package list with the following command:
    sudo apt-get updateLinux VPN setup: step 2
  5. Install the NordVPN client:
    sudo apt-get install nordvpnLinux VPN setup: step 3
  6. Initiate the login to your Nord account:
    nordvpn loginLinux VPN setup: step 4
  7. Your command line will show a link for logging in via your browser. Follow the link to the Nord Account page and enter your credentials. You may also need to use an authenticator app for multi-factor authentication.Linux VPN setup: step 5
  8. Once you’re logged in on the browser, you can connect to a NordVPN server to establish a VPN connection:
    nordvpn connectLinux VPN setup: step 6

NordVPN will choose the most suitable and fastest VPN server for you. If you want to connect to a specific country or server, you can find the table with commands toward the end of this article.

If you’re still having trouble, check our video instructions:

You can also find instructions for different distributions here, visit our help page, or contact customer support.

How to set up a VPN on Linux with the OpenVPN application

If you want to configure NordVPN the old-fashioned way, you’re welcome to check out our detailed tutorial. To sum up the process:

  1. Install OpenVPN and configure it on your computer.
  2. Download our OpenVPN configuration files into your OpenVPN directory.
  3. Make sure you configured everything correctly, and select your NordVPN server if you did.
  4. Finally, establish an OpenVPN connection and connect to the internet through NordVPN.

How to set up a VPN on Linux with Network Manager

It’s also possible to set up a VPN on Linux using Network Manager. Detailed instructions with screenshots are here, and the TL;DR version follows:

  1. Download our OpenVPN configuration files.
  2. Update your system and the Network manager.
  3. Import OpenVPN configuration files in the VPN settings.
  4. Connect to the VPN server, which settings you’ve just imported.

How to set up your own Linux VPN server

You may be wondering, “Can I create my own VPN on Linux?”

It’s Linux – of course, you can.

You can set up your VPN server by installing OpenVPN, adjusting ports and protocols, changing DNS settings to redirect the traffic through your VPN, and taking further steps. The instructions are complicated and deserve a separate article.

But if you only want to encrypt and route your traffic through another device, there’s a simpler way. You can use NordVPN’s Meshnet feature.

With Meshnet, you can use your own Linux server or computer as your VPN server.

Instead of connecting to a VPN server managed by a VPN provider, you connect to your or your friend’s Linux device from another device linked by Meshnet. The devices connect to each other via an encrypted tunnel and use each other’s IP addresses. You can even access your files remotely this way.

NordVPN Linux app commands

Using NordVPN on Linux is pretty straightforward too. Here are the commands you’ll need most often:

CommandWhat it does
nordvpn loginLogs you in
nordvpn connect / nordvpn cConnects you to NordVPN server
nordvpn disconnect / dDisconnects you from NordVPN server
nordvpn connect (e.g. nordvpn connect uk715)Connects you to a specific NordVPN server
nordvpn set / nordvpn sSets a configuration option
nordvpn set threatprotectionlite on or offEnables or disables Threat Protection Lite
nordvpn set killswitch on or offEnables or disables Kill Switch
nordvpn set meshnet on or offEnables or disables Meshnet
nordvpn settingsLists the current settings
nordvpn statusShows your connection status
nordvpn refreshRefreshes the server list
nordvpn countriesDisplays the country list
nordvpn logoutLogs the user out of their NordVPN
nordvpn help / nordvpn hShows a list of commands (like how to turn on Threat Protection Lite) or help for one specified command

How to choose a VPN for Linux?

If you don’t have a VPN subscription, you’ll need one for a Linux VPN setup. Here’s how to choose the best VPN provider:

  • Choose a premium VPN provider. Free VPNs can log your data to sell it for profit. They have to make money in some way, and if it’s not from subscriptions, you can expect the worst.
  • Make sure the VPN has many servers in different countries. More servers mean more options for you when connecting to a particular country. It also impacts the connection speed because providers with fewer servers can have a lot more users connected to the same server.
  • Pay attention to security protocols. VPN services use different VPN protocols for encrypting your connection. Some protocols are better for security, while others are better for offering a fast connection. For example, OpenVPN is considered to be the most secure protocol among the experts, while NordVPN’s NordLynx is the best for speed. You should choose a VPN service and protocols that meet your browsing needs.
  • Check the extra features. Premium VPN providers offer additional features that can be useful or even replace the need for some other tools. For example, NordVPN’s Threat Protection prevents malware infection and blocks trackers and ads. Meanwhile, you can join virtual LAN parties or access files stored on remote devices if you use Meshnet.

Online security starts with a click.

Stay safe with the world’s leading VPN