We may earn affiliate commissions for the recommended products. Learn more.
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:
ExpressVPN
NordVPN
Surfshakr
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 loginand 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.
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:
Open “Terminal” on your Linux computer
Type “sh <(curl -sSf https://downloads.nordcdn.com/apps/linux/install.sh)” and press Enter.
The NordVPN Linux app will automatically download and install on your Linux PC.
To log into your VPN account, type “nordvpn login”in the terminal and enter your NordVPN credentials.
To connect to a VPN server, type “nordvpn connect”
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:
Open the ExpressVPN website and log in to your VPN account.
Search for Linux set up in the user dashboard and click on it.
Once the installation process is completed, type “expressvpn activate + ExpressVPN Activation code” and press Enter.
Type “expressvpn connect,” and you will be connected to the nearest VPN server.
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.
To change your VPN protocol type “expressvpn protocol lightway_tcp or expressvpn protocol tcp” in the terminal.
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:
Open the Terminal by using the keyboard shortcut Ctrl + Alt + T.
Disable IPv6 and ensure it is turned off on your system. Refer to the instructions for disabling IPv6 if needed.
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.
Navigate to the OpenVPN configuration directory by typing: cd /etc/openvpn
Download the OpenVPN configuration files by using this command:
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
Install the unzip package if it is not already installed by entering: sudo apt-get install unzip
Extract the configuration files from the downloaded ZIP file by using this command: sudo unzip ovpn.zip
Remove the ZIP file to free up space by typing: sudo rm ovpn.zip
Enter the directory containing server configuration files. Use the following commands for UDP or TCP servers respectively:
cd /etc/openvpn/ovpn_udp/
cd /etc/openvpn/ovpn_tcp/
Display all available server files by running: ls -al
Choose a server from the list. For example, us2997.nordvpn.com is used here.
Start OpenVPN with the chosen configuration using one of the following commands:
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:
Open the Terminal using the keyboard shortcut Ctrl + Alt + T.
Install the network-manager-openvpn by entering the following commands:
Enter your user password if prompted. When asked, “Do you want to continue? [Y/n],” type Y and press Enter.
Restart the Network Manager after installation by running: sudo service network-manager restart
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.
Click the double arrow button in the top-right corner of the screen and select “Edit Connections” from the drop-down menu.
Press “Add” to create a new VPN connection.
In the prompt to choose a connection type, select “Import a saved VPN configuration” and click “Create.”
Navigate to the folder where the configuration files were saved, select a file, and click “Open.”
Enter your NordVPN username and password when prompted, then press “Save” and close all open windows.
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.
Mustafa is a cybersecurity analyst and a co-founder of VPN for What. Since 2017, Mustafa has gained international experience, working with governments, NGOs, and the private sector as a cybersecurity and VPN expert and advisor.