Installing Private internet access with OpenVPN on Ubuntu Server

I wanted to use a VPN on my ubuntu server, after googling I gathered a bunch of information from various sources. The following is a step by step guide of what I did. Hopefully it will will work for someone else as well.
install openvpn 
  1. sudo apt-get install openvpn
Download The Private Internet Access OpenVPN configuration files
  1. wget https://www.privateinternetaccess.com/openvpn/openvpn.zip
Unzip the files
  1. unzip openvpn.zip -d ~/openvpn
Move the files to the openvpn directory
  1. sudo mkdir /etc/openvpn/pia
  2. sudo mv ~/openvpn/* /etc/openvpn/pia/
Create a credentials file 
  1. sudo nano /etc/openvpn/auth.txt
on the first line enter your username
on the second line enter your password
Save the file and change permissions on it
  1. sudo chmod 400 /etc/openvpn/auth.txt
Copy the following 2 files to the openvpn directory
  1. sudo cp /etc/openvpn/pia/ca.rsa.2048.crt /etc/openvpn/ca.rsa.2048.crt
  2. sudo cp /etc/openvpn/pia/crl.rsa.2048.pem /etc/openvpn/crl.rsa.2048.pem
To have the vpn connect automatically on system startup copy the opvn file you wish to use to the openvpn directory changing it to a .config file.
  1. sudo sudo cp /etc/openvpn/pia/UK\ London /etc/openvpn/UKLondon.conf
Edit the config file 
  1. sudo nano /etc/openvpn/UKLondon.conf
Find the line that says
auth-user-pass
and change it to
auth-user-pass auth.txt
Test the connection by running the vpn
  1. cd /etc/openvpn
  2. sudo openvpn --config /etc/openvpn/UKLondon.conf
If all runs well reboot the system and check your ip address with the following command.
  1. wget http://ipecho.net/plain -O - -q ; echo
Subscribe
Notify of
guest

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

5 Comments
Inline Feedbacks
View all comments
Anon
Anon
4 years ago

This guide is amazing. Thank you! Everything I was looking for!

Lindsay Mathieson
Lindsay Mathieson
3 years ago

Brilliant, thanks, worked perfectly and your instructions were very clear/easy to follow.

nb. Running in an lxd container too (ubuntu 20.04)

Last edited 3 years ago by Lindsay Mathieson
J W
J W
3 years ago

Still working only change is instead of
sudo sudo cp /etc/openvpn/pia/UK\ London /etc/openvpn/UKLondon.conf
make it something like
sudo sudo cp /etc/openvpn/pia/uk_london.ovpn /etc/openvpn/UKLondon.conf

They changed the pia folder

   
5
0
Would love your thoughts, please comment.x
()
x