Can someone please give me a guide to setup a vpn connection (that connects on startup) using openvpn and ubuntu 16.04 server. all the guides on the internet are wrong, outdated, or just don't work. i have an account with private internet access and i just want to setup a connection. something i feel should be very simple but i lack the experience needed as this is my first server and I'm still learning.


Start by downloading this: https://www.privateinternetaccess.com/openvpn/openvpn.zip and extract it somewhere.

That archive contains 3 important files: ca.crt, crl.pem and YourServer.ovpn (e.g. Germany.ovpn), copy those to /etc/openvpn/. Rename the .ovpn file to .conf and add a line auth-user-pass secrets Create a new file /etc/openvpn/secrets with your PIA username on the first and your password on the second line, like this:


For security reasons you should chmod 600 that.

See if your connection works: systemctl start openvpn@YourServer (e.g. systemctl start openvpn@Germany. Debug as necessary: tail -f /var/log/syslog|grep ovpn and systemctl status openvpn@YourServer

If it works, make it run on startup by editing /etc/default/openvpn and uncommenting the line that says AUTOSTART="all"

  • 1
    My SSH connection dropped as soon as i started the openvpn service, and I couldn't reconnect to my server (Ubuntu EC2), so I had to restore it from an AMI. – The Onin May 5 '17 at 12:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.