VPN FOR WHAT

How to set up a VPN on Linux in 2025

We may earn affiliate commissions for the recommended products. Learn more.

How to set up a VPN on Linux in 2025

How to set up a VPN on Linux in 2025: A Summary

Secure a Linux device with a VPN by subscribing to a VPN provider with a Linux VPN app. Here is a list of them:

  1. ExpressVPN
  2. NordVPN
  3. Surfshakr
  4. ProtonVPN

There are three methods to install a VPN on your Linux PC. The best and easiest is to install a VPN app on your Linux system and enjoy complete anonymity:

  • Open the Terminal on your Linux computer.
  • Enter the command to download and install the NordVPN app: sh <(curl -sSf https://downloads.nordcdn.com/apps/linux/install.sh)
  • Log in to your NordVPN account by typing: nordvpn login and enter your credentials.
  • Connect to a VPN server by running: nordvpn connect
  • Your Linux device is now secured with NordVPN.

I have also outlined additional methods to configure a VPN on Linux using the OpenVPN client and Network Manager. Furthermore, I highly recommend using a reliable VPN on Linux OS. NordVPN stands out with its highly optimized servers and secure VPN protocols. Additionally, it offers a fully-featured VPN app specifically designed for Linux, making it a great choice for Linux users.

Linux is a secured operating system in comparison with Windows and Android. This means your device is automatically protected from malware and virus threats, but that does not guarantee the online protection of your identity and data.

Like other operating systems, you need a VPN for Linux to hide your IP address and encrypt your internet data. Additionally, a VPN allows you to access geo-restricted websites and apps when installed on your Linux system.

I have discussed three ways to set up a VPN on Linux, starting with the easiest method and ending with the most challenging one. I have also highlighted the best VPNs that provide Linux apps and are easy to install.

How to set up a VPN on Linux

Setting up a VPN on Linux requires basic computer (Linux) skills. You will need to enter different commands to install and use a VPN on your Linux devices. Here are three methods of configuring a VPN on a Linux PC.

  • Install a VPN client (Linux VPN app)
  • Install the OpenVPN application
  • Add OpenVPN configuration in the Network Manager
Methods Linux VPN app OpenVPN Client Manual Setup
Set-Up Difficulty Easy Medium Hard
Requirements VPN app for Linux OpenVPN app for Linux OpenVPN file configuration
Drawbacks None Lengthy process Switching servers is difficult
Speed Very Fast Fast Slow

 

1. Setting up a VPN on Linux with VPN client

This is the easiest method among the three but requires a Linux VPN app. However, not all commercial VPN providers provide a Linux VPN app that is compatible with operating systems built on Linux, like Ubuntu, Fedora, Kali Linux, Linux Mint, and Pop! OS.

Another important point to mention is that VPN providers with a Linux VPN app typically provide an installation guide. These guides outline the necessary steps and specific commands to install the VPN on Linux.

For this section, I am using NordVPN and IPVanish to demonstrate setting up a VPN on Linux. While the basic steps are similar, the commands may vary between providers. You can find a Linux-specific installation guide on your VPN provider’s website or contact their customer support if you’re unable to locate the page.

Here are the steps to install a VPN client on your Linux PC:

For NordVPN users

You will need a NordVPN subscription and a Linux PC for this set up. Here are the steps to install and use NordVPN on Linux:

  1. Open “Terminal” on your Linux computer
  2. Type “sh <(curl -sSf https://downloads.nordcdn.com/apps/linux/install.sh)” and press Enter.
  3. The NordVPN Linux app will automatically download and install on your Linux PC.
  4. To log into your VPN account, type “nordvpn login” in the terminal and enter your NordVPN credentials.
  5. To connect to a VPN server, type “nordvpn connect”
  6. Your Linux devices are not secure with a NordVPN.

Setting up a commercial VPN on your Linux devices sounds difficult, but in reality, it is easy. Here are more Linux commands for NordVPN users.

For ExpressVPN users

ExpressVPN subscribers can follow these steps to secure their Linux devices:

  1. Open the ExpressVPN website and log in to your VPN account.
  2. Search for Linux set up in the user dashboard and click on it.
  3. You will be directed to the ExpressVPN Linux setup page.
  4. Select your Linux operating system like “Ubuntu, Fedora, Arch, Rasberry Pi OS” and click on download.
  5. Copy the “VPN Activation Code” to use ExpressVPN on Linux.
  6. Now open the “Terminal” and run the CD~/Downloads/ command, and navigate where the installer is downloaded.
  7. To install the ExpressVPN Linux app you have to type a command depending on your Linux distribution.
    1. Ubuntu / Debian / Mint: sudo dpkg -i [installer filename]
    2. Fedora: sudo dnf install [installer filename]
    3. Arch: sudo pacman -U [installer filename]
  8. Once the installation process is completed, type “expressvpn activate + ExpressVPN Activation code” and press Enter.
  9. Type “expressvpn connect,” and you will be connected to the nearest VPN server.
  10. To connect to a different location, type “expressvpn list all,” or you can directly connect to a specific location by typing expressvpn connect “USA – New Jersey” in the terminal.
  11. To change your VPN protocol type “expressvpn protocol lightway_tcp or expressvpn protocol tcp” in the terminal.
  12. Finally, if you want to disconnect, type “expressvpn disconnect” in the terminal.

Setting up a VPN on Linux requires more typing and commands than configuring a VPN on Windows, Android, or another device. However, typing these commands is easy for Linux users because they are used to this interface and its operations.

If you don’t want to get into writing these commands and installing a native Linux VPN app on your device. Then, install a VPN on your router, which is connected to your Linux devices, or install a VPN browser extension to secure your browsing activities.

2. Installing a VPN on Linux with an OpenVPN client

The second method to install and use a VPN on Linux is through an OpenVPN client. OpenVPN is a widely used VPN protocol supported by most commercial VPN providers. It has been thoroughly tested and vetted by auditors, third-party security agencies, and developers, with continuous improvements over time.

Unlike the WireGuard VPN protocol, OpenVPN provides an application for various operating systems. This allows you to configure a VPN on your device without needing a dedicated VPN app. Here are the steps to install an OpenVPN client app on Linux:

  1. Open the Terminal by using the keyboard shortcut Ctrl + Alt + T.
  2. Disable IPv6 and ensure it is turned off on your system. Refer to the instructions for disabling IPv6 if needed.
  3. Install the OpenVPN client by entering the following command: “sudo apt-get install OpenVPN.” You may be prompted to enter your user password to proceed.
  4. Navigate to the OpenVPN configuration directory by typing: cd /etc/openvpn
  5. Download the OpenVPN configuration files by using this command:
    1. sudo wget https://downloads.nordcdn.com/configs/archives/servers/ovpn.zip
    2. If an error occurs stating The certificate of ‘nordvpn.com’ is not trusted, install the CA certificates package with the following command: sudo apt-get install ca-certificates
  6. Install the unzip package if it is not already installed by entering: sudo apt-get install unzip
  7. Extract the configuration files from the downloaded ZIP file by using this command: sudo unzip ovpn.zip
  8. Remove the ZIP file to free up space by typing: sudo rm ovpn.zip
  9. Enter the directory containing server configuration files. Use the following commands for UDP or TCP servers respectively:
    1. cd /etc/openvpn/ovpn_udp/
    2. cd /etc/openvpn/ovpn_tcp/
  10. Display all available server files by running: ls -al
  11. Choose a server from the list. For example, us2997.nordvpn.com is used here.
  12. Start OpenVPN with the chosen configuration using one of the following commands:
    1. sudo openvpn [file name]
    2. sudo openvpn us2957.nordvpn.com.udp.ovpn
    3. sudo openvpn /etc/openvpn/ovpn_udp/us2957.nordvpn.com.udp.ovpn
  13. Enter your NordVPN credentials when prompted.
  14. Disconnect from the VPN by pressing Ctrl + C in the terminal.

Your Linux system is now secured with an OpenVPN client. These steps allow you to set up any VPN that supports the OpenVPN protocol on a Linux system. OpenVPN is one of the most secure VPN protocols, unlocking geo-restricted websites and bypassing VPN blocks.

3. Setting up VPN on Linux with Network Manager (Manual Setup)

Here are the steps to manually set up a VPN on Linux with Network Manager:

  1. Open the Terminal using the keyboard shortcut Ctrl + Alt + T.
  2. Install the network-manager-openvpn by entering the following commands:
    1. sudo add-apt-repository universe
    2. sudo apt-get update
    3. sudo apt-get install network-manager-openvpn-gnome
  3. Enter your user password if prompted. When asked, “Do you want to continue? [Y/n],” type Y and press Enter.
  4. Restart the Network Manager after installation by running: sudo service network-manager restart
  5. Visit the servers page of your VPN provider. Select the recommended server and click “Show available protocols.” Download the OpenVPN TCP and OpenVPN UDP configuration files. Save them in a folder and note its location.
  6. Click the double arrow button in the top-right corner of the screen and select “Edit Connections” from the drop-down menu.
  7. Press “Add” to create a new VPN connection.
  8. In the prompt to choose a connection type, select “Import a saved VPN configuration” and click “Create.”
  9. Navigate to the folder where the configuration files were saved, select a file, and click “Open.”
  10. Enter your NordVPN username and password when prompted, then press “Save” and close all open windows.
  11. Click the double arrow button again, select “VPN connections” from the drop-down menu, and choose the server you set up to connect.

Final thoughts

Installing a VPN on your Linux device enhances security and protects your online identity and activities. I recommend using a reliable VPN, such as ExpressVPN or NordVPN, to unblock geo-restricted websites and apps. Both services offer highly optimized VPN servers that work seamlessly with Linux.

Having personally used both VPNs, I can confirm they perform exceptionally well on Linux. In addition to their superior service, their customer support teams are highly responsive and helpful. For instance, a NordVPN support agent assisted me in configuring a VPN connection on my Ubuntu PC, ensuring a smooth setup experience.

Also, read VPN set up on other devices:

More articles from the VPN Setup section

Leave a Reply

Your email address will not be published. Required fields are marked *