You can support us by downloading this article as PDF from the Link below. Download the guide as PDF

In our guide today, we are looking at how to install Pritunl VPN server on Ubuntu 20.04. Pritunl VPN is an opensource VPN server and management system. It utilizes a graphical interface that is friendly and easy to use to the user. It is secure and provides a good alternative to the commercial VPN products. It has the ability to create a wide range of cloud vpn networks which can support over a thousands of users.

Features of Pritunl VPN

Below are the most notable features of Pritunl VPN that makes it an option for many:

  • Simple to install and configure
  • Supports multi-cloud VPN peering
  • Offers upto five layers of authentication making it more secure.
  • Supports Wireguard, giving clients theoption to connect with openvpn or Wireguard
  • Quickly and easily scale to thousands of users, having high availability in the cloud environment without the need for expensive proprietary hardware
  • supports all OpenVPN clients with official clients for most devices and platforms.
  • Create multi-cloud site-to-site links with VPC peering. VPC peering available for AWS, Google Cloud, Azure and Oracle Cloud.
  • Interconnect AWS VPC networks across AWS regions and provide reliable remote access with automatic failover that can scale horizontally
  • Pritunl is built on MongoDB, a reliable and scalable database that can be quickly deployed

Pritunl VPN Architecture Review

Pritunl VPN presents an distributed and scalable infrastructure that quickly and easily scale to thousands of users, having high availability in the cloud environment without the need for expensive proprietary hardware. It works on server-client architecture, where servers and users are configured on the VPN server and clients profiles are downloaded to be used on the clients.

Pritunl is built on MongoDB, a reliable and scalable database that can be quickly deployed. With built in support for replication a reliable database can be setup in minutes making a Pritunl cluster deployment fast and easy.

Installing Pritunl VPN server on Ubuntu 20.04

To install Pritunl VPN server on Ubuntu 20.04, we are going to follow a number of steps as stated below:

Step 1: Update your system

First update and upgrade your system before beginning installation by running the below commands:

sudo apt-get update
sudo apt-get -y upgrade

Step 2: Add Pritunl and MongoDB repositories and public keys

Next, add Pritunl repository to your Ubuntu 20.04 using the below command.

echo "deb http://repo.pritunl.com/stable/apt focal main" | sudo tee /etc/apt/sources.list.d/pritunl.list

Pritunl VPN is build from MongoDB. We will go ahead to also add Mongodb repository using the command below:

echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.4.list

Now add public keys for MongoDB and Pritunl repositories.

curl -fsSL https://www.mongodb.org/static/pgp/server-4.4.asc | sudo apt-key add -
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com --recv 9DA31620334BD75D9DCB49F368818C72E52529D4
sudo apt update

Step 3: Install Pritunl and MongoDB

Install Pritunl and MongoDB on Ubuntu 20.04 with the below commands:

sudo apt --assume-yes install pritunl mongodb-server

Now start and enable Pritunl and MongoDB as below:

sudo systemctl start pritunl mongodb
sudo systemctl enable pritunl mongodb

Step 4: Configure Pritunl on Ubuntu 20.04

At this point, Pritunl VPN is installed and running. Access it from the browser using your server IP to configure it. http://<your_server_ip>. You should get a page as below:

Generate setup-key by running the command below:

$ sudo pritunl setup-key 
c76683c87efe4774887a9a223a2f1fd6

Once you enter the setup-key and mongodb url, it will prompt you for username and password.

The default username and password are obtained with the below command:

$ sudo pritunl default-password
[undefined][2020-11-15 18:01:55,033][INFO] Getting default administrator password 
Administrator default password: 
 username: "pritunl" 
 password: "xGupSTJtdiJ8"

When you login with the provided credentials, you get a page as below:

Set your new password and save and you should be taken to a page to configure organizations, users and servers.

To add users, click on ‘Users’. This takes you to a window to first add organization.

Click on ‘Add organization’ then provide it a name then click ‘Add’.

Your organization should now be added as below

Click on ‘Add user’ to create a user. Provide the required details and click ‘Add’.

If you want to add many users at once, click on ‘Bulk Add user’.

Let’s now create a Vpn server. Click on ‘servers’ then ‘Add server

Provide server particulars and click ‘Add’. You should see that the server has successfully been added as below:

Remember to attach the server to an organization by clicking on ‘Attach organization’ and choosing your organization.

Step 5: Configure Pritunl Client on Ubuntu 20.04

We are now going configure Pritunl VPN client to connect to Pritunl server. For Ubuntu 20.04, run the below commands to install Pritunl VPN client.

sudo tee /etc/apt/sources.list.d/pritunl.list << EOF
deb https://repo.pritunl.com/stable/apt focal main
EOF
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com --recv 7568D9BB55FF9E5287D586017AE645C0CF8E292A
sudo apt-get update
sudo apt-get install pritunl-client-electron

Once client is installed, go back to the server to download user profile. Click on ‘Users’ select the particular user and click on the download icon to get the user profile. It should be similar to the below:

Once you install Pritunl VPN client, you should be able to see Pritunl VPN client icon installed as part of your application.

Click on it and import your profile in order to connect to the Pritunl VPN server.

To connect to the Pritunl VPN server from the terminal, we are going to use ‘nmcli’ command. Ensure that network manager is already installed on your Ubuntu 20.04. If not run the command below to install:

sudo apt-get install network-manager  network-manager-openvpn
# with Gnome Desktop environment, use:
sudo apt-get install network-manager-gnome network-manager-openvpn-gnome

Now run the below command to import openvpn profile

sudo nmcli connection import type openvpn file Lorna_lorna_Pritunl-VPN.ovpn 
Connection 'Lorna_lorna_Pritunl-VPN' (17636314-1508-4828-9f95-65304af94660) successfully added.

To start using the profile, bring it up using:

nmcli connection up Lorna_lorna_Pritunl-VPN.ovpn

Enjoy using Pritunl VPN!! Check below more interesting Linux guides:

You can support us by downloading this article as PDF from the Link below. Download the guide as PDF