How to Set up a VPN on Linux

With each passing year, it looks like more and more flavors of Linux appear – optimized for all kinds of purposes. Well, know that no matter what flavor of Linux you use, you can reap the numerous benefits of a VPN service. There are many ways to install a VPN on Linux, but it all comes down to three methods. You can use a Linux VPN app supplied by your VPN service, use Terminal to set up an OpenVPN connection, or use Ubuntu’s Network Manager. These are three very different methods, but they all take you to the same goal. So, let’s talk about how to set up a VPN on Linux in 2020.

We strongly believe that when writing installation guides like this one, staying away from general descriptions is always beneficial. That’s why we’ll focus on a recommendation based on our hands-on experience, and that would be none other than ExpressVPN. This truly is the best VPN available right now, and this applies to Linux users as well. You get plenty of servers, several VPN protocols to choose from, and you can decide which installation method works for you. Of course, this isn’t where your options stop, as we’ve compiled a list of the best VPNs for Linux. However, keep in mind that VPNs come with different installation methods, so it’s always best to contact your VPN is you pick something other than ExpressVPN.

So, here are 3 different methods to set up a VPN on Linux in 2020:

Method #1: Use Your VPN’s Linux Application

For this method, you need a VPN that provides a Linux application. Our recommendation is to use ExpressVPN, as it comes with applications for Ubuntu, Fedora, Arch, and other Linux distributions (for both 32- and 64-bit). So, here’s how to set up a Linux VPN by using native software.

  • Once you sign-up for a new account, you’ll get to access your account on ExpressVPN’s website. Open its home page, click on “My Account” and supply your credentials. Once you get to your account dashboard, click on the “Set Up Other Devices” button. Then, choose “Linux” on the left side and pick your Linux distribution on the right. Download the corresponding file to your computer. Make sure to keep this page open, as we’ll need the information found here soon enough.

ExpressVPN Manual Configuration Setup Information
  • Now, you need to use the Command Line (Terminal) to complete the installation. You first need to open the package you’ve just downloaded. By default, the file will be in your Downloads folder (accessible via the “cd Downloads/” command). Now, open the file using the “sudo dpkg -i [installer filename]” command (for Ubuntu, Mint, and Debian distributions). You can use the “sudo yum install [installer filename]” for Fedora and similar distributions.

Download ExpressVPN Ubuntu Linux Procedure
Image Courtesy of ExpressVPN.

  • Then, open a new Terminal window and run the “expressvpn activate” command to activate the VPN application. You’ll be asked for an activation code, so go back to ExpressVPN’s website (the page you left open in the background) and paste the activation code found there. You’ll also be asked to send anonymous data like crash reports and speed tests, which you can decide to allow or to disallow.

That’s it! You’re now free to use ExpressVPN’s command line-based app. To connect to the nearest server based on your location (or the previously used server), use the “expressvpn connect” command. To disconnect, go with “expressvpn disconnect.”

Connecting to Individual Server ExpressVPN Linux
Image Courtesy of ExpressVPN.

As you can imagine, you can also connect to other ExpressVPN servers. For this purpose, you can check out the available servers using the “expressvpn list” or “expressvpn list all” commands. If you’d like to connect to a particular server, enter the “expressvpn connect [LOCATION CODE]” as in “expressvpn connect nyc.” You can also connect to a specific country, for which you can use the following command: “expressvpn connect Germany.”

ExpressVPN Access Codes Linux
Image Courtesy of ExpressVPN.

Finally, we also recommend using the “man expressvpn” command if you’d like to reveal all of ExpressVPN’s commands. This is where you’ll learn how to check the status of your VPN connection, switch to a different VPN protocol, and more.

Method #2: Set Up a Linux VPN via Terminal (OpenVPN)

This method requires you to use a VPN that supports the OpenVPN protocol. Once again, we recommend using ExpressVPN for this purpose. Here’s how to install and active OpenVPN on your Linux computer, and then connect to a VPN server.

  • First, you need to obtain your OpenVPN configuration files. This means that you need to access your user account dashboard on ExpressVPN’s website (once you subscribe to the VPN, that is). Then, click on “Set Up Other Devices” and pick “Manual Configuration” on the page that should appear at this moment.

ExpressVPN OVPN Files Selection
  • Check if “OpenVPN” is selected on the right-hand side. Now, this is where you’ll find your OpenVPN username and password, so make sure to keep this page open until the end of this process. Take a look below as well, which is where you’ll find individual OpenVPN files for each ExpressVPN’s server. Feel free to download any file based on the server you’d like to connect to later on.
  • Now, we need to install OpenVPN. Use the “sudo apt-get install -y openvpn” command. Then, enter the configuration screen by using the “sudo openvpn –p /etc/openvpn/update-resolv-conf –down /etc/openvpn/update-resolv-conf –script-security 2 –config” command. This is for Ubuntu Linux, while other distributions can use the “sudo openvpn –config” command.

OpenVPN Linux Installation
Image Courtesy of ExpressVPN.

  • Finally, you need to drag and drop the recently downloaded OVPN file onto the Terminal window. The path will be automatically captured.

To connect to a server, you need to press “Enter” once the path (described above) is loaded. You’ll see a string of commands, and the final one should say “Initialization Sequence Completed,” which means that your VPN connection is live now. To disconnect, simply exit the Terminal window. Keep in mind that the Terminal window must be open as long as you wish to use your VPN. You’re free to minimize the window, but don’t close it.

Method #3: Configure a Linux VPN via Ubuntu Network Manager

Ubuntu’s Network Manager is a handy utility for controlling your Web connectivity. As such, it supports installing and managing VPN connections. However, keep in mind that you need an OpenVPN-powered VPN for this purpose, and we highly recommend ExpressVPN. Here’s how to set up a VPN on Linux via Network Manager.

  • We’ll assume that by now, you have your ExpressVPN credentials. So, go ahead and download the required VPN configuration files. This is done by logging to your account on ExpressVPN’s website and then clicking on “Set Up Other Devices. A new page should open, where you need to select “Manual Configuration” and then take a look at the right side of the page.
  • At the top, you should see your OpenVPN username and password, so make sure to keep this page open until we’re done with this process. Then, take a look below, and you’ll see a list of servers offered by ExpressVPN. Pick any server that you’d like to use and click on its name. This will download an OVPN file to your computer. Also, make sure to scroll down until you see the “Optional” card, from where you can download a ZIP file. Make sure to download this file, as we’ll need these certificates and keys.
  • Once you unzip the file you’ve downloaded, launch a new Terminal session. Now, run the “sudo apt-get install -y network-manager-gnome” command. Once you install the Network Manager, you’ll see its icon on your desktop bar notification area. Click on this icon and then select “Edit Connections.”

Linux Gnome VPN Command
Image Courtesy of ExpressVPN.

  • A new window will appear. You need to click on the “Add” button and then select “Import a saved VPN configuration.” Finally, click on the “Create” button, and you’ll get to pick the OVPN file you’ve previously downloaded. Then, you’ll need to manually import the User Certificate (client.crt), CA Certificate (ca2.crt), and Private Key (client.key) files from the previously unzipped file.

OpenVPN Preferences Linux
Image Courtesy of ExpressVPN.

  • Using this same window, make sure to set “Authentication Type” to “Password with Certificate (TLS)” and then input your OpenVPN username and password (from ExpressVPN’s website).
  • Click on “Advanced” and select the “General” tab. Enter “1195” in the field that says “Use custom gateway port.” Also, make sure to check the following fields: Use LZO data compression; Use customer tunnel maximum transmission unit (1500); Use custom UDP fragment size (1300); Restrict tunnel TCP maximum segment size; Randomize remote hosts.
  • Using the “Security” tab, select “AES-256-CBC” for the cipher, and “SHA-525” for the HMAC authentication. Then, click on the “TLS Authentication” tab.

TLS Authentication Linux Network Manager
Image Courtesy of ExpressVPN.

  • Using this tab, check the box next to “Use additional TLS authentication” and then select the “ta.key” file from the ZIP archive you’ve previously downloaded. Set “1” for the “Key Direction.”

That’s it! You are now free to connect to your VPN server by clicking on the Network Manager icon. Go to “VPN Connections,” and your newly added server should be waiting. Also, keep in mind that you can repeat the procedure explained above to add additional servers.

Finally, we’ve reached the end of our guide on how to set up a VPN on Linux. As you can see, Linux users have several installation methods to pick, depending on the level of complexity you seek. If you encounter any problem along the way, feel free to post a comment below – and we’ll do our best to assist you in a timely manner.

REVIEW OVERVIEW

Recent Articles

Coming to Hulu in November 2020 – Watch ‘Run,’ ‘Tesla,’ More

Golden leaves have barely hit the ground, and the air is slightly chilly, but we're already getting Christmas movies on Hulu's November...

Last Chance to Watch These Movies on Hulu – Leaving in November 2020

By the end of November, Hulu will be ditching a bunch of movies that have expiring licenses. If you want to watch...

U.S. DoJ Prepares Legal Action Against Google for Monopolistic Practices

The United States Department of Justice is going officially against Google, accusing the tech giant of monopolistic practices.Chrome, Google Search, and Google...