How to Set Up and Use PrivateVPN on Linux?

We are reader supported and may earn a commission when you buy through links on our site. Learn more.

The simplest way to set up PrivateVPN on your Linux machine is through the Network Manager Integration (TUN) method. You can also switch to your preferred PrivateVPN open-source protocol and activate the Kill Switch feature.

The only drawback is the absence of a GUI app, but if you don’t mind manual configurations, then it’s a go.

Keep reading to learn the steps to set up and use PrivateVPN on your Linux system.

How to Set Up PrivateVPN on Linux via Network Manager Integration (TUN)? (Recommended)

Best for beginners and users seeking a simplified setup due to its user-friendly interface and straightforward configuration.

The Network Manager Integration (TUN) method is the recommended setup for PrivateVPN on Linux since it’s more efficient than the TAP and OpenVPN CLI methods for creating a secure point-to-point connection.

To kick things off, ensure you have a stable internet connection and a PrivateVPN subscription.

  1. Choose a preferred PrivateVPN server location and download it here. I’ll download the Norway – Oslo server.
download privatevpn norway olso server config file for linux
  1. Launch the terminal in your Linux system. I’ll use Ubuntu for this guide.
searching linux terminal
  1. In the terminal, type the command sudo apt-get install network-manager-openvpn network-manager-openvpn-gnome resolvconf and hit enter.
adding sudo apt command on unbuntu
  1. Type in the password for your Linux system to activate the installation process.
entering linux system password on ubuntu
  1. Once the download is complete, open System Preferences > Network in your Linux. Click + to add PrivateVPN to your network list.
locating plus icon in privatevpn on linux
  1. Select “Import from file” to import the configuration file for the previously downloaded server location.
import from file option on linux network settings
  1. Click “Open” to access the configuration file.
open privatevpn configuration file
  1. Enter the following information to set up your PrivateVPN server.
  • Name: (preferred name)
  • Username: (PrivateVPN registered email address)
  • Password: (PrivateVPN password)
  1. Click “Add” to add the VPN.
locating add button in identity settings on linux
  1. Toggle the button to start the connection process.
enable oslo server on linux
  1. There you go! PrivateVPN is set up on your Linux device. You can now take control of the overall security of your Linux system, including streaming live TV and sports events on platforms such as BBC iPlayer.

How to Set Up PrivateVPN on Linux via OpenVPN Network Manager Integration (TAP)?

Best for proficient to expert users comfortable with command-line tools.

Although the Network Manager Integration (TUN) method is best for setting up PrivateVPN on Linux, you can also try the Network Manager (TAP).

But only use this method if you can’t use the TUN method since this isn’t as modern or straightforward and doesn’t offer the high level of security that TUN does.

It’s better suited for networking scenarios that require bridged connections, and its nature as a bridging tool might expose more information than necessary for typical VPN connections, potentially compromising security.

Follow these stepwise processes to set up PrivateVPN manually on Linux.

  1. Buy a PrivateVPN subscription. To save more, choose the multiyear plan.
privatevpn pricing
Image for illustration only. Design, deals, and details may differ. Click on the image for current info.
  1. Download the PrivateVPN certificate here.
  2. Launch your Linux system. I’ll use Ubuntu 22.04.3 LTS for this guide.
  3. Open “Files” on your Linux machine to access the PrivateVPN certificate you downloaded.
searching for files on linux
  1. Click “Downloads” from the menu bar on the left.
selecting downloads tab on linux
  1. Right-click the file you downloaded, and select “Extract here” to extract the file.
selecting extract here option on linux
  1. Open the Terminal on your Linux system.
search linux terminal
  1. Enter the command sudo apt-get install -y network-manager-openvpn and press enter.
adding sudo apt y network manager openvpn command on linux
  1. Enter your system user password to initiate installation.
adding system password on linux
  1. Once the installation process is complete, go to Settings > Network. Click + to add the PrivateVPN profile.
selecting plus symbol on linux
  1. Click “OpenVPN.”
selecting openvpn vpn on linux
  1. Enter the following information
  • Connection name: PrivateVPN
  • Gateway: Depends on your preferred country or server. I connected to the Netherlands server. Here’s a list of servers to help you choose.
  • Type: Password
  • User name: PrivateVPN user name
  • Password: PrivateVPN password
adding privatevpn openvpn identity on linux
  1. Click the icon on the right of the “CA certificate” to access the extracted file.
selecting ca certificate on linux
  1. Locate the extracted file and click Select.
locating select button in ca certificate on linux
  1. Click “Advanced” at the bottom of the pop-up box.
locating advanced settings on linux
  1. Check the “Use custom gateway port” box. Enter the port number from the Server List. I chose the Netherlands server with port number 21000.
adding gateway port number on linux advanced properties
  1. Check the “Data compression” box and select “LZO” from the dropdown menu.
selecting lzo as data compression on linux
  1. Check the “Set virtual device type” and select “TAP” from the dropdown menu.
setting tap as virtual device type on linux
  1. Click Apply to save network settings.
selecting apply on linux advanced properties
  1. Click Add to add PrivateVPN to your network list.
selecting add button for privatevpn on linux
  1. Toggle by PrivateVPN to start the connection.
toggle to activate privatevpn on linux
  1. To disconnect from PrivateVPN, toggle the button again to turn it off.
toggle privatevpn to disconnect on linux

How to Set Up PrivateVPN for Linux via OpenVPN CLI?

Best for all user levels.

Another way to manually set up PrivateVPN on Linux is to use the OpenVPN CLI method.

This is the best alternative to the TUN method because it operates at the network layer and is great for point-to-point connections. It’s also suitable for most VPN use cases.

Here’s how to set it up:

  1. Get a PrivateVPN subscription and launch your Linux system. I’ll use Ubuntu 22.04.3 LTS.
  2. Choose your preferred PrivateVPN server location and download it here. For this guide, I’ll use the US-New Jersey server.
privatevpn openvpn configuration files
  1. Launch the terminal on your Linux machine.
search linux terminal
  1. In your terminal, type the command sudo apt-get install openvpn curl and press enter.
adding install openvpn curl command on linux
  1. Enter your system password.
adding system password on linux
  1. Once the OpenVPN installation is complete, enter Y to continue.
entering y for openvpn installation on linux
  1. Enter the command sudo openvpn [path of the server configuration file]. The path should look like: /home/vpnuser/Downloads/PrivateVPN-US-NewJersey-TUN-1194.ovpn.
adding sudo openvpn command on linux
  1. Enter your PrivateVPN registered email address and password in Auth username and Auth password to establish the connection.
adding privatevpn auth username and password on linux
  1. Once you get “Initialization Sequence Completed,” you’re connected and can now use PrivateVPN on your Linux system.
initialization sequence completed status on linux

How to Set Up PrivateVPN Kill Switch on Linux?

With PrivateVPN’s kill switch, you can add an extra layer of security to your Linux connection.

This way, if you’re working remotely on a confidential project using your Linux machine and your VPN connection drops, the kill switch will immediately cut off your internet, ensuring no one else sees your sensitive work.

Here’s how to set up the PrivateVPN kill switch on Linux:

  1. Obtain the IP address of the VPN gateway you wish to set up for the kill switch. To do this, choose your preferred server location from this list. For this guide, I’ll use US – New Jersey.
privatevpn server locations
  1. Take note of the hostname of the VPN gateway under the “Server address.” Since I chose US – New Jersey, the hostname will be us-jer.pvdata.host. I’ll use this alongside PrivateVPN’s OpenVPN-TUN-UDP protocol.
  1. Launch the terminal in your Linux system. I’ll use Ubuntu for this guide.
  1. In your terminal, type the host command followed by the hostname of the server location: “host [hostname of the VPN gateway from step 1]” and press Enter. In this case, “host us-jer.pvdata.host.” This will display the IP address of the VPN gateway.
adding host command and hostname on linux
  1. Next, type the command “route” to find out the name of your Internet Facing Network Interface. You’ll find the name under “Use Iface.”
locating internet facing network interface on linux
  1. Enter the command “cd /etc/openvpn/client” to make changes in the client “.ovpn configuration.”
adding ovpn configuration command on linux
  1. Type the command “ls -al” to verify if there is an existing configuration file.
entering ls -al command on linux
  1. You’ll get this output if no configuration file exists.
no configuration file output on linux
  1. Copy the sample client.conf file using the command “sudo cp /usr/share/doc/openvpn/examples/sample-config-files/client.conf .
adding sample client configuration command on linux
  1. Type “sudo nano client.conf” to edit the client.conf file.
entering sudo nano client configuration command on linux
  1. Locate the default remote option.
privatevpn client file default remote options
  1. Use # to comment out the default remote option.
using # to comment out default remote option on linux
  1. Enter the IP address you got in step 4. In this case, 193.37.253.2 2100 udp.
entering ip address on linux
  1. Click Ctrl + X to display save options and Y to save changes.
display save options on linux

To finish setting up the PrivateVPN Kill switch on your Linux machine, you can use iptables or ufw. Let’s explore both:

How to Set Up PrivateVPN Kill Switch Using Iptables?

First, here are the steps to set up PrivateVPN kill switch with Iptables: 

  1. In your Linux terminal, enter the command “nano iptables-ks.sh” to create iptables-ks.sh.
adding nano iptables command on linux
  1. In the nano editor, paste the content below. Replace the IP address with the IP specific to the server location you selected in step 4. Click Ctrl + X to continue.

The iptable rule set below expunges and removes every pre-existing rule set in iptables. It outrightly drops every outgoing connection other than the one to PrivateVPN server IP in US New Jersey to port 21000 using the UDP protocol. Also, all incoming and outgoing connections are allowed over the virtual network interface TUN0 exclusively.

				
					#!/bin/bash iptables --flush iptables --delete-chain iptables -t nat --flush iptables -t nat --delete-chain iptables -P OUTPUT DROP iptables -A INPUT -j ACCEPT -i lo iptables -A OUTPUT -j ACCEPT -o lo iptables -A OUTPUT -j ACCEPT -d 193.37.253.2/32 -o enp0s3 -p udp -m udp --dport 21000 iptables -A INPUT -j ACCEPT -s 193.37.253.2/32 -i enp0s3 -p udp -m udp --sport 21000 iptables -A INPUT -j ACCEPT -i tun0 iptables -A OUTPUT -j ACCEPT -o tun0
				
			
adding ip table rule on linux
  1. Click “Y” to select Yes and save changes in the nano editor.
choosing yes for iptable rule on linux
  1. Run the command “sudo chmod +x iptables-ks.sh # ./iptables-ks.sh” to activate the iptables ruleset for deploying a Kill Switch.
adding sudo chmod command on linux
  1. Enter your system password to continue.
adding system password in sudo chmod command on linux

How to Set Up PrivateVPN Kill Switch Using “ufw.”?

And here are the steps to set up PrivateVPN kill switch with ufw.: 

  1. In your Linux terminal, enter the command “nano ufw-ks.sh” to create ufw-ks.sh.
adding nano ufw command on linux
  1. In the nano editor, paste the content below. Replace the IP address “193.37.253.2” with the IP for your chosen server location. Also, replace the name “enp0s3” with the name you found under “Use Iface.”
				
					ufw --force reset ufw default deny incoming ufw default deny outgoing ufw allow in on tun0 ufw allow out on tun0 ufw allow out on enp0s3 to 193.37.253.2 port 21000 proto udp ufw allow in on enp0s3 from 193.37.253.2 port 21000 proto udp ufw enable
				
			
ufw force reset command on linux
  1. Press Ctrl + X to access options and press Y to save changes.
save options in ufw force reset command on linux
  1. Run the command “# chmod +x ufw-ks.sh # ./ufw-ks.sh.” Then, enter the system password and press enter to activate your kill switch.
adding nano ufw and sudo chmod system password on linux

There you go!

FAQs

PrivateVPN’s Linux setup doesn’t support IPv6. For Linux users, you need to disable IPv6 for the service to work properly, as PrivateVPN does not have a native app for Linux.

Obtain dedicated IP details from your account to connect to PrivateVPN Dedicated IPs on Linux. Install PrivateVPN CLI, download dedicated IP configuration files, and use the terminal to navigate to the files’ directory. Initiate the connection using the PrivateVPN CLI command with the dedicated IP configuration, enter credentials, and verify the connection matches the assigned dedicated IP.

Ready to Use PrivateVPN for Linux?

Whether streaming content on VLC, browsing through Chromium, or connecting via SSH, PrivateVPN encapsulates your data with Linux-like precision.

Plus, it’s easy to set up!

Ready to get started? Grab these PrivateVPN deals and protect your data!

PrivateVPN logo
PrivateVPN devices
EXCLUSIVE December DEAL!
Our partner, PrivateVPN, offers an exclusive discount for a limited time! Don't miss out on the chance to save extra money.
OFFER EXPIRES IN:
Hours
Minutes
Seconds
TODAY!
VIEW EXCLUSIVE OFFER
Or Try PrivateVPN for FREE