DEV Community

Samuel Ajisafe
Samuel Ajisafe

Posted on • Edited on

How to Setup Pritunl on Ubuntu Server

In this tutorial, we'll walk through the complete setup of the Pritunl VPN server on Ubuntu 22.04.

Pritunl is an open-source enterprise VPN server and management platform. With its intuitive web interface and strong security features, it offers a powerful alternative to commercial VPN solutions. Pritunl supports both OpenVPN and WireGuard, and is designed to scale easily to thousands of users—perfect for modern cloud environments.

Image description

🌟 Key Features of Pritunl

  1. Easy installation and configuration

  2. Multi-cloud VPN peering support for AWS, Google Cloud, Azure, and Oracle Cloud

  3. Up to five layers of authentication

  4. Supports both OpenVPN and WireGuard

  5. Scales seamlessly to thousands of users with high availability

  6. Official clients available for all major platforms (compatible with any OpenVPN client)

  7. Built on MongoDB, with fast and reliable replication support

Pritunl Architecture Overview
Pritunl uses a server-client architecture, where VPN servers and users are managed centrally via the web interface. Clients connect using downloaded profiles.

It is built on top of MongoDB, a scalable NoSQL database. This makes it easy to deploy a Pritunl cluster with built-in database replication and high availability, all without the need for expensive hardware.

✅ This setup has been fully tested on Ubuntu 22.04. I’ll continue updating this guide if there are any future changes.

Step 1: Install Required Dependencies
Start by updating your system and installing essential packages:

sudo apt update && sudo apt install -y \
  wget vim curl gnupg2 software-properties-common \
  apt-transport-https ca-certificates lsb-release
Enter fullscreen mode Exit fullscreen mode

Step 2: Install Legacy OpenSSL (Required for MongoDB 6)

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 7AE645C0CF8E292A
wget http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2_amd64.deb
sudo dpkg -i libssl1.1_1.1.1f-1ubuntu2_amd64.deb
Enter fullscreen mode Exit fullscreen mode

Step 3: Add MongoDB and Pritunl Repositories

wget -qO - https://www.mongodb.org/static/pgp/server-6.0.asc | sudo apt-key add -

echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/6.0 multiverse" \
  | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list
Enter fullscreen mode Exit fullscreen mode

Step 4: Install MongoDB and Pritunl

sudo apt update
sudo apt install -y pritunl mongodb-org
Enter fullscreen mode Exit fullscreen mode

Step 5: Start and Enable Services

sudo systemctl start pritunl mongod
sudo systemctl enable pritunl mongod
sudo systemctl status pritunl mongod
Enter fullscreen mode Exit fullscreen mode

You should see both services running without issues.

Step 6: Access the Pritunl Web Interface
Now that Pritunl is running, you can access the web interface:

Open your browser and go to:
http://

Note: Make sure ports 80 and 443 are open on your server.

Image description

Generate setup-key by running the command below:

sudo pritunl setup-key
Enter fullscreen mode Exit fullscreen mode

Once you enter the setup-key and MongoDB URL, it will prompt you for a username and password.

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

sudo pritunl default-password
Enter fullscreen mode Exit fullscreen mode

When you log in with the provided credentials. Set your new password and save and you should be taken to a page to configure organizations, users, and servers.

Image description

Step 8. Create a User

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.

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.

Image description

Your Firewall should mimic the image below:

Image description

🧩 Step 9: Link Server to Organization
Once logged in, create an Organization, User, and Server. Then link the server to the organization to begin assigning user profiles.

Click on Server, then click on Attach Organisation

Image description

Once Attached Click on Start Server.

The setup is now completed.

Here is the guide on how to setup the client side

Follow this link 'https://client.pritunl.com/' to download the Pritunl client, mobile device download OpenVPN from Playstore or Appstore.

Install client and upload downloaded profile to client and click connect.

📚 Reference
This guide was inspired by Vinayak's Pritunl Setup Guide, with updates and improvements based on the latest best practices.

🚧 Note: The original reference has been updated. I will continue to maintain this documentation as new changes emerge.

DevOps #SRE #HybridCloud #Cloud #Security #VPN #PrivateNetwork #Network #OpenVPN #Pritunl

Top comments (0)