matomo

Best deal of the year - get 77% off our 2-year plan for Black Friday! Get Deal

Install OpenVPN for Raspbian

This guide is also available in Svenska, Deutsch and Norsk

Supported versions: Raspbian Buster Lite, Raspbian Buster with desktop

Last updated: February 10, 2020

1. Update the Raspberry Pi

sudo apt-get update
sudo apt-get upgrade

2. Install OpenVPN

sudo apt-get install openvpn unzip

Use OVPN if security is of importance

Your privacy and security is the core focus of OVPN. That's why we've implemented a multi-layered security model.

Learn more

3. Make sure the time zone is correct

Run the command below and go through the configuration prompt to select the correct time zone.

sudo dpkg-reconfigure tzdata

4. Choose region you want to connect to

5. Elevate your privileges to root

sudo -i

6. Download configuration file & setup OpenVPN

7. Enter your login credentials

echo  "CHANGE TO YOUR USERNAME"  >> /etc/openvpn/credentials
echo "CHANGE TO YOUR PASSWORD" >> /etc/openvpn/credentials

8. Start OpenVPN and see that everything works

sudo openvpn --config /etc/openvpn/ovpn.conf --daemon

9. Verify that the connection was successful

Wait for about a minute after running the last command, then run:

curl https://www.ovpn.com/v2/api/client/ptr | python -m json.tool

You should see something like:

{"status":true,"ip":"46.227.67.132","ptr":"cliXXX.ovpn.com"}

10. Done

Congratulations! Now your Raspberry Pi will run behind OVPN. The Raspberry Pi will connect automatically when it is started.

Troubleshooting

In case the connection was not set up properly when you verified it in the previous step, please send us the OpenVPN log so we can assist. You can retrieve it by writing:

sudo -i
cat /tmp/openvpn.log

You can also check if OpenVPN is running properly by writing:

ps aux | grep openvpn