Install Pritunl on Ubuntu 16

Update your bare-bone and freshly installed Ubuntu 16 system.

sudo apt-get update && sudo apt-get upgrade

Add Pritunl’s APT repository and update the package lists:

echo "deb trusty/mongodb-org/3.0 multiverse" > /etc/apt/sources.list.d/mongodb-org-3.0.list
echo "deb trusty main" > /etc/apt/sources.list.d/pritunl.list

Add repo keys for apt to validate against

apt-key adv --keyserver hkp:// --recv 7F0CEB10
apt-key adv --keyserver hkp:// --recv CF8E292A

Update the package cache

sudo apt-get update

If you have a firewall running on the Linode, add exceptions for Pritunl’s Web UI and server:

sudo iptables -A INPUT -p udp -m udp --sport 9700 --dport 1025:65355 -j ACCEPT
sudo iptables -A INPUT -p tcp -m tcp --sport 9700 --dport 1025:65355 -j ACCEPT
sudo iptables -A INPUT -p `your protocol here` -m `your protocol here` --sport `your_port_here` --dport 1025:65355 -j ACCEPT

NoteIf you’ve configured the firewall according to the Securing Your Server guide, be sure to add these port ranges to the /etc/iptables.firewall.rules file.

Install Pritunl and its required dependencies:

sudo apt-get install python-software-properties pritunl mongodb-org

Start the Pritunl service:

sudo service pritunl start

Open a web browser on your computer, and navigate to, replacing with your VM IP address. You will see a screen similar to this:

Connect to the database. The installer has already populated the MongoDB URI. If it looks correct, click Save.


If you see something different like your mongodb is not running, then probably you need to create the following script and run:

Create a configuration file named mongodb.service in /etc/systemd/system to manage the MongoDB service.

sudo vim /etc/systemd/system/mongodb.service
#Unit contains the dependencies to be satisfied before the service is started.
Description=MongoDB Database
# Service tells systemd, how the service should be started.
# Key `User` specifies that the server will run under the mongodb user and
# `ExecStart` defines the startup command for MongoDB server.
ExecStart=/usr/bin/mongod --quiet --config /etc/mongod.conf
# Install tells systemd when the service should be automatically started.
# `` means the server will be automatically started during boot.

Update the systemd service with the command stated below:

systemctl daemon-reload

Start the service with systemcl.

sudo systemctl start mongodb

Check if mongodb has been started on port 27017 with netstat command:

netstat -plntu

Check if the service has started properly.

sudo systemctl status mongodb

The output to the above command will show `active (running)` status with the PID and Memory/CPU it is consuming. Enable auto start MongoDB when system starts.

sudo systemctl enable mongodb

Configuring Pritunl:

Login with the following information:

Username: pritunl
Password: pritunl

Or follow on screen instructions to generate user password.

The Initial Setup form will appear:

Fill out the form, and press Save.

Go to the Users tab. Here, you will create your organizations and users. Begin by clicking Add Organization and entering a name. Next, click Add User and add a user to the organization you just created.

Go to the Servers tab. Click Add server. You will see a screen like the following:

If a firewall is set up, make sure that the Port and Protocol fields match the firewall exceptions added earlier. Click the Attach Organization button. Attach the organization to the server.

Connecting to the Server

To connect to the server, you can use any OpenVPN compatible client. For Android or iOS, you can use the free OpenVPN Connect app available in the Google Play or iOS App Store. For Linux, there is an official client available for Ubuntu. Mac and Windows users can use any OpenVPN client.

You can download your required edition from the link below:

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'


Install MongoDB on Ubuntu 16.04 LTS


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.