How To Install Pritunl On Ubuntu 20.04

This document provides a step-by-step guide on installing Pritunl, a free and open-source VPN server, on Ubuntu 20.04.
Prerequisites
Prior to commencing the installation process, ensure the following prerequisites are met:
- A server running Ubuntu 20.04. A fresh installation is recommended.
- A user account with
sudoprivileges. - A stable internet connection.
Step 1: Update the System
Begin by updating the system's package lists and upgrading existing packages to their latest versions. This ensures compatibility and security.
Must Read
sudo apt update
sudo apt upgrade -y
Step 2: Install MongoDB
Pritunl relies on MongoDB as its database. Install the required version of MongoDB.
First, import the MongoDB GPG key:
wget -qO - https://www.mongodb.org/static/pgp/server-4.4.asc | sudo apt-key add -
Next, add the MongoDB repository to the system's package sources:
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
Update the package lists again:
sudo apt update
Install MongoDB:
sudo apt install mongodb-org -y
Start and enable the MongoDB service:
sudo systemctl start mongod
sudo systemctl enable mongod
Verify that MongoDB is running:

sudo systemctl status mongod
Step 3: Install Pritunl Repository
Add the Pritunl repository to the system's package sources.
First, create the Pritunl apt key:
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com --recv 7568D9BB55FF9E5287D586017AE645C0CF8E292A
Add the Pritunl repository:
sudo tee /etc/apt/sources.list.d/pritunl.list <
Step 4: Install Pritunl
Update the package lists and install Pritunl.
sudo apt update
sudo apt install pritunl -y
Start and enable the Pritunl service:
sudo systemctl start pritunl
sudo systemctl enable pritunl
Verify that Pritunl is running:
sudo systemctl status pritunl
Step 5: Access the Pritunl Web Interface
Pritunl's web interface is accessible through a web browser. Obtain the initial setup key and access the interface.

Get the initial setup key by using the following command:
sudo pritunl setup-key
Copy the key displayed in the output. Open a web browser and navigate to the server's public IP address or domain name. The default port is 443, so the URL would be https://<your_server_ip>.
Paste the setup key into the designated field on the web interface and click "Save".
Create an administrator account by providing a username, email address, and password.
Step 6: Configure Pritunl
After logging in, you can configure Pritunl according to your needs.
Adding a Server
Click on "Add Server". Choose a name for the server and select the MongoDB database. Click "Add".
Adding an Organization
Click on "Users", and then "Add Organization". Choose a name for the organization. Click "Add".

Adding Users
Select the organization you just created. Click "Add User". Provide a username and click "Add".
Attaching the Organization to the Server
Go back to the "Servers" tab. Click the server you created. Then, click the "Attach Organization" button and select the organization you created.
Step 7: Install the Pritunl Client
To connect to the Pritunl VPN server, you need to install the Pritunl client on your device. The client is available for Windows, macOS, and Linux.
Download the client from the official Pritunl website: https://client.pritunl.com/
Install the client according to the instructions provided for your operating system.
Step 8: Import the User Profile
To connect to the VPN, you need to import the user profile into the Pritunl client.
In the Pritunl web interface, go to the "Users" tab, select the organization, and then select the user you created. Click the "Download Profile" button.

Open the Pritunl client and click the "Import Profile" button. Select the downloaded profile file.
Step 9: Connect to the VPN
Select the imported profile in the Pritunl client and click the "Connect" button. Enter the username and password for the user you created.
If the connection is successful, you will be connected to the Pritunl VPN server.
Firewall Configuration
Ensure your firewall allows traffic on the necessary ports. By default, Pritunl uses UDP port 1194. If you modified this during setup, use the port you configured.
sudo ufw allow 1194/udp
sudo ufw enable
Check the status of the firewall:
sudo ufw status
Considerations
- Security: Regularly update Pritunl and MongoDB to ensure you have the latest security patches. Use strong passwords and enable two-factor authentication for administrative accounts.
- Performance: The performance of your VPN will depend on the server's resources and the network connection. Consider using a server with sufficient CPU, RAM, and bandwidth.
- Customization: Pritunl offers various customization options, such as DNS settings, routing rules, and client-to-client communication. Explore these options to tailor the VPN to your specific needs.
- Backups: Regularly back up your Pritunl configuration and MongoDB database to prevent data loss in case of a server failure.
Practical Advice
Implementing a VPN solution like Pritunl can significantly enhance your online privacy and security, especially when connecting to public Wi-Fi networks. It creates an encrypted tunnel for your internet traffic, making it more difficult for malicious actors to intercept your data. Furthermore, a VPN can allow you to bypass geo-restrictions and access content that may be unavailable in your region.
Consider using a VPN when:
- Connecting to public Wi-Fi at coffee shops, airports, or hotels.
- Accessing sensitive information, such as online banking or financial accounts.
- Wanting to prevent your internet service provider (ISP) from tracking your browsing activity.
- Accessing content that is geo-restricted in your location.
