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.
- sudo apt-get install openvpn
Download The Private Internet Access OpenVPN configuration files
- wget https://www.privateinternetaccess.com/openvpn/openvpn.zip
Unzip the files
- unzip openvpn.zip -d ~/openvpn
Move the files to the openvpn directory
- sudo mkdir /etc/openvpn/pia
- sudo mv ~/openvpn/* /etc/openvpn/pia/
Create a credentials file
- 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
- sudo chmod 400 /etc/openvpn/auth.txt
Copy the following 2 files to the openvpn directory
- sudo cp /etc/openvpn/pia/ca.rsa.2048.crt /etc/openvpn/ca.rsa.2048.crt
- 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.
- sudo sudo cp /etc/openvpn/pia/UK\ London /etc/openvpn/UKLondon.conf
Edit the config file
- sudo nano /etc/openvpn/UKLondon.conf
Find the line that says
and change it to
Test the connection by running the vpn
- cd /etc/openvpn
- sudo openvpn --config /etc/openvpn/UKLondon.conf
If all runs well reboot the system and check your ip address with the following command.
- wget http://ipecho.net/plain -O - -q ; echo
This guide is amazing. Thank you! Everything I was looking for!
Glad it helped!
Brilliant, thanks, worked perfectly and your instructions were very clear/easy to follow.
nb. Running in an lxd container too (ubuntu 20.04)
I’m glad you found my little tutorial helpful!
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