How to set up a VPN on Linux

Virtual private network – VPN – is a technology that ensures the privacy and security of online activities while using the existing infrastructure of the internet. As a Linux user, you probably care a lot about privacy and security. Hence, you should be interested in harnessing the power of the OpenVPN protocol and the powerful 256-bit encryption it uses. But how do you set up a VPN on Linux? 

There are two ways to do it, both of which use the terminal app (accessed via Ctrl+Alt+T):The easiest way is to set up a VPN is to install a dedicated app. In this case, you’ll only need a VPN app that works with Linux.

The other way is to install it manually – then you’ll need to install OpenVPN, have VPN configuration files from a VPN provider as well as login data. Read on and find out how it’s actually done!

The steps you need to take should be similar for every VPN provider. But we’ll be using Surfshark for demonstration purposes.

Set up a VPN on Linux with Surfshark App

The easiest way to set up a VPN on your Linux system is to get the Surfshark VPN app. It was made on Debian and tested on Ubuntu. Here’s a short guide:

1. Sign up for a Surfshark account

Sign up for a Surfshark

2. Open Terminal (Ctrl+Alt+T)

3. Install Surfshark VPN for Linux by using the command “sudo apt-get install {/path/to/}surfshark-release_1.0.0-1.1_amd64.deb”

4. Update the apt-get package with the command: “sudo apt-get update”

5. Complete the installation with “sudo apt-get install surfshark-vpn”

6. You’re done!

What do you do next? Well, our support page has tips on how to connect to servers and what other terminal commands you can use! 

Set up VPN on Linux manually 

Granted, you may not always want or be able to set up a VPN by just installing a handy app. In case you want to carry it out manually by using OpenVPN, here’s a guide:

1. Open the terminal window by pressing Ctrl + Alt + T.

2. Install the required OpenVPN materials by using the command “sudo apt-get install openvpn unzip”

2a. If you are requested to enter your password, please enter your computer’s admin password.

3. Go to the OpenVPN directory by entering command “cd /etc/openvpn”

4. Sign up for Surfshark.

Sign up for a Surfshark

5. Get the Surfshark OpenVPN configuration files by entering the command “sudo wget

6. Extract the `` with the command “sudo unzip configurations”

7. Remove the .zip file which will no longer be needed

8. Open the list of available servers by entering “ls” in the command line.

9. To connect to a chosen Surfshark server, enter the command “sudo openvpn [file name]”.

9a. For example, here’s how you connect to a Dallas server:

sudo openvpn

sudo openvpn /etc/openvpn/

10. To find your Surfshark service credentials (they’re not the same as your account log in information) for OpenVPN, go to the manual connection guide at the top of the page.

11. If you see “Initialization Sequence Completed” in the Terminal logs, you have successfully connected to Surfshark.

12. If you want to disconnect from OpenVPN, open the terminal and press Ctrl+C.

If you have any questions about the process, you can always turn to our customer support service that works 24/7 via email or a live chat. 

Bonus: set up a VPN using Ubuntu Network Manager

Are you a Ubuntu user? Then you can set up Surfshark by using your handy Network Manager app. Here’s how it’s done:

1. If the Network Manager is not installed on your device, open Terminal (Ctrl+Alt+T) and enter the command “sudo apt-get install network-manager-openvpn-gnome”.

You will be asked to enter your computer’s password – do so. Now you have the Network Manager 

2. Once you have the Network Manager (or if you have it already), sign up for Surfshark.

Sign up for a Surfshark

3. Log in to the Surfshark website and go here.

4. Download the UDP files for the server you like and save them on the desktop for convenience. Don’t close the window yet – we’ll need it later.

5. Click the white arrow or the Wi-Fi/Ethernet icon – it should be at the top right corner of your desktop.

6. Click the “Settings” button.

7. Open the “Network” tab. 

8. Click the “+” sign to add a new VPN network.

9. In the new window, click “import from file”

10. Navigate to the file you downloaded at step #4 and import it.

11. Once your asked for authentication, enter the Surfshark service credentials that you can find at the bottom of the page you opened at step #3.

12. A new VPN profile is added. Turn it on by flipping the switch to “ON.”

13. To see if the VPN is connected, open the system tray exactly the way you did in step #5.

And that’s all there is to it! Again, if you have questions, our 24/7 support team is always ready to help. 

Do I need a VPN on Linux?

Whatever operating system a person is using, they can still benefit from having a VPN:

  • Privacy: With a VPN running, all of your online traffic is encrypted. This means that anyone reading or intercepting your data between you and the VPN server won’t be able to read it. T
  • Security: you love the fact that Linux isn’t haunted by malware like Windows is. But other threats still lurk online. Whether you’re using P2P file-sharing or browsing online on public Wi-Fi at a library, there are malicious actors who could use your freely-shared IP address and unsecured communications to cause you harm. 
  • Access: what to do when geo-blocking prevents you from reaching the entertainment you want? With a VPN, Netflix and other streaming service libraries will be as accessible as they can be without being free. 
  • Bypassing censorship: Not all governments share the Linux users’ opinion that information should be free. With a VPN, you can overcome blocks from the most basic – like DNS – to the most sophisticated – like deep package inspection. 

In Conclusion

Linux is the system of choice for people who value privacy and security. However, the privacy and security benefits of Linux don’t extend to the internet, and that’s why you need additional help. Set up a Linux VPN on your distribution of choice and experience the freedom of the internet that you deserve.

Get Surfshark VPN for Linux!

Download Surfshark