Private VPN on Ubuntu Server or Raspberry Pi

I can run my own VPN that becomes an encrypted, point-to-point connection from anywhere? Say what? Relatively safe and secure using public wifi?

Yes, it’s true. You can setup PiVPN on your Ubuntu Server or Raspberry Pi device. There are three components to this: PiVPN running on the server, the UFW firewall configuration, and the mobile device app.

First, install PiVPN

curl -L https://install.pivpn.io | bash

Most of the suggested configuration options should be applicable.

Once PiVPN is installed, you will need to add a user.

pivpn -a

Give it a profile name and password. The file will be saved in a folder in your home directory called ‘ovpn’. You will want to save that to a flash drive and then import to your phone/tablet. I used FTP. There are many other ways to do this, but the flash drive method is most secure.

Configure UFW

sudo ufw allow 1194/udp
sudo ufw allow OpenSSH

Ask UFW to generate a list to make sure there are no double entries and delete them! Those double entries can mess up the PiVPN’s ability to connect.

sudo ufw status numbered

sudo ufw delete x ("x" is the double entry)

Now, download “OpenVPN” app in your smartphone app store. It’s free. Then open the app and choose the third option, “OVPN Profile”.

Add the ovpn file you generated on your server. You can choose the “save private key password” if you would like. I use this because my phone has a fingerprint security feature. Once you connect, you will be connected to your home network from anywhere! Perfect security for pubic wifi.

 

 

 

 

Leave a comment

Your email address will not be published. Required fields are marked *