In this day and age, VPN or Virtual Private Networks are awesome tools to help you protect your privacy. A VPN changes or masks your current IP address with other address where the VPN server is hosted. One of the good reasons to consider having your own VPN, rather than to go for online companies, is to have your data controlled on your own hands. Now, this becomes really true when you host the server at your home itself. However, if you are thinking of having a completely different IP based on some specific region, then getting a virtual machine is the best way to set up a VPN. Do note that companies giving you access to IP address when you get a virtual machine, might send you claims if you do access pirated content or something that is banned by law. That out of the way, if you still think you are enough of a tech geek to host your VPN, follow this tutorial along.

Let's break things down into steps to make it easier. Below mentioned are 5 steps to achieve a personal VPN.

  1. Get a virtual machine running Ubuntu 18.04 to work along this tutorial. There are many options available for VM's like Google Cloud, Digital Ocean, Linode etc.. If you feel lost setting up a virtual machine with one of those providers, there are numerous guides available online. Seach on google for their installation references. That just will not be covered in this tutorial to keep things short.

  2. Ensure that ubuntu is up-to-date. Run the following command.

        sudo apt-get update && sudo-apt upgrade
  3. If you have Apache/Nginx running on tcp ports 80 or 443, make sure to stop them before you proceed. Pritunl uses both your port 80/443.

        # For Apache
        sudo systemctl stop apache2 
        # For Nginx
        sudo systemctl stop nginx

  1. Install the Pritunl and MongoDB repositories.

        sudo tee /etc/apt/sources.list.d/mongodb-org-4.2.list << EOF
        deb xenial/mongodb-org/4.2 multiverse
        sudo tee /etc/apt/sources.list.d/pritunl.list << EOF
        deb xenial main
  2. Add the public keys for the repositories. This step is done to ensure we get the correct repository.

        sudo apt-key adv --keyserver hkp:// --recv E162F504A20CDF15827F718D4B7C549A058F8B6B
        sudo apt-key adv --keyserver hkp:// --recv 7568D9BB55FF9E5287D586017AE645C0CF8E292A
  3. Now reload all the repositories.

        sudo apt update
  4. Install the required packages and start the pritunl server

        sudo apt-get --assume-yes install apt-transport-https
        sudo apt-get update
        sudo apt-get --assume-yes install pritunl mongodb-org
        sudo systemctl start pritunl mongod
        sudo systemctl enable pritunl mongod
  5. Open the web browser on your compter and navigate to, replacing with your VM's IP address. You should see a screen with pre-filled local mongoDB string.

  6. Once on the page, you shall need your Pritunl Setup Key. This can be retreived by running this simple command: sudo pritunl setup-key. Enter the key in the appropriate area and click on save.

Configuring Pritunl
  1. Next step is to Log in with the Pritunl information. In normal cases, you will need your default random generated password which you can retreive by running: sudo pritunl default-password. If not prompted to use the command, use these credentials: username: pritunl , password: pritunl

  2. Fill out all the information asked on the next screen and press save. The SMTP settings are not nescessary to move on and will not do anything unless you have a pritunl license purchased.

  3. On your Pritunl Dashboard, go to users and create a new user by adding your credentials.

  4. Go to the Servers tab and add server. Add a port that you have already enabled in the firewall settings for your virtual machine. Then, click on Attach Organization and attach to the server.

Connecting to the server
  1. Now, you will have to connect to your server to mask your IP address. This can be done using any OpenVPN compatible client. You can use the free OpenVPN connect app for android or iOS. For Linux, there is a official client available for Ubuntu. Mac and Windows can use any OpenVPN client. This is the address for OpenVPN website if you need more information on OpenVPN.

  2. Now you need to get your keys. Next to your username on the dashboard, there will be a Online/Offline indicator. Next to that, there will be two buttons. There should be an option to download the TAR file with your login and required credentials.