How to install the Pritunl VPN on Debian & Ubuntu

One of the fastest and best free and open-source VPN with user management and horizontal scaling for small and large organizations. One size fits them all VPN.

You are looking at installing your own VPN? Don't look further! Pritunl comes with a bunch of features that will make you regret paying for private VPN.

Before installing Pritunl you will need a VPS. You can create a small droplet on Digital Ocean. If you have not created an account you may use the referral link to receive a $100 credit when creating an account. After logging in click Create Droplet then follow the tutorial to install Pritunl on your VPS.

Scaleway is a great alternative to Digital Ocean. If you manage to snatch a Stardust instance you'll be able to run your VPN for less than $2 a month. One of the advantages of Scaleway is that you don't pay for outgoing traffic. You are dependent on the outgoing network speed. If you want to increase the speed of the VPN you have to increase the size of the VPS.

Let's get started, I assume that you have an Ubuntu/Debian instance running and that you are connected to it.

Prerequisites:

  • Ubuntu Focal 20.04 LTS
  • Debian Buster

Install Pritunl

Add Pritunl Package

Pritunl isn't available right out of the box. You need to add the packages.

Depending on your operating system, either follow the instruction for Debian Buster or the Ubuntu Focals one.

Debian Buster

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

Ubuntu Focal

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

Once you've installed sudo apt-get update

You should now be able to install Pritunl.  Before doing that we'll need to add MongoDB as Pritunl requires it.

Don't worry about performance. Even the smallest VPS on DigitalOcean and Scaleway can run both Pritunl and MongoDB

Add MongoDB Package

Import the public key

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

Create the list file

echo "deb http://repo.mongodb.org/apt/debian buster/mongodb-org/4.4 main" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.4.list
    
sudo apt-get update
    

Install MongoDB and Pritunl Packages

Now that both packages have been added, you can install MongoDB and Pritunl by running the following commands

sudo apt-get install -y mongodb-org pritunl
    

Start the MongoDB and Pritunl Services

To start both Pritunl and MongoDB you'll need to start the services.

sudo systemctl start pritunl mongod
    

Increase Open File Limit

Run the commands below to increase the open file limit on the server. This will prevent connections issues on servers with high load. This should also be done on the MongoDB server. Use the command sudo lsof -p pgrep pritunl-web | wc -l to check the file count for the Pritunl web server.

sudo sh -c 'echo "* hard nofile 64000" >> /etc/security/limits.conf'
    sudo sh -c 'echo "* soft nofile 64000" >> /etc/security/limits.conf'
    sudo sh -c 'echo "root hard nofile 64000" >> /etc/security/limits.conf'
    sudo sh -c 'echo "root soft nofile 64000" >> /etc/security/limits.conf'
    

Configure Pritunl

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 
    

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

sudo pritunl default-password
    
    ... 
    
    
    [undefined][2021-01-29 20:10:17,550][INFO] Getting default administrator password
    Administrator default password:
     username: "pritunl" 
     password: "xGupSTJtdiJ8"
    

I hope that you've successfully installed Pritunl. You should be able to connect to it either by using the Pritunl App or by using the OpenVPN Client app on Android, iOS, macOS, Windows, Linux, etc ...

Please reach out to me if you've experienced any issues, and I'll happily help you. I hope this tutorial has been useful, and you'll enjoy private networking from now on.