How To: Install OpenVPN on a Raspberry Pi

Setting up a Virtual Private Network (VPN) was the most difficult and frustrating Raspberry Pi installation I’ve attempted.   I’m not sure if the guides I was using were outdated, simply not correct, or if I was doing something wrong.   There were many many complex steps and the issue could very well have been on my side.   This all changed once I found an automated script that performs the entire  installation process with one command.

To start this project, you’ll need a newly configured Raspberry Pi.   For this type of project I suggest using a RPi device that’s wired into your router and assigned a static IP address.   See setting-up-your-new-raspberry-pi before proceeding with these steps.

To start the installation process enter the following command in the terminal application on your Raspberry Pi and follow the onscreen instructions:

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

Yes!  It’s really that easy!

Once the software is loaded, UDP port 1194 needs to be port-forwarded on your router to the Raspberry Pi’s IP address. Since all routers operate differently, there is no way I can offer help.   Use Google if needed to determine how.

Once the installation process is complete it is time to create client keys. This is done easily by typing the following command in your terminal session:

pivpn add

You are once again led through a quick form where you type in the name of the client and the password. This creates an .opvn file that can be transferred to the client to allow access to the VPN. I used FTP to transfer the file to my computers.

Leave a Reply

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

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