Here is a quick guide on setting up OpenVPN with PIA VPN (Private Internet Access)
I am running Raspbian Jessie Lite on a Raspberry Pi 3, i will also be investigating running this with OSMC in the future.
First off we need to ensure your Pi is up to date and install the OpenVPN software
sudo apt-get update
sudo apt-get install openvpn
Once installed make sure you are in the pi users home directory
create a new folder called pia_profiles and navigate into that folder
Download the PIA profiles from Pia website, the download is a zip file
Extract the files
Now we need to copy some files over to the openvpn install folder
sudo cp crl.rsa.2048.pem /etc/openvpn/crl.rsa.2048.pem
sudo cp ca.rsa.2048.crt /etc/openvpn/ca.rsa.2048.crt
The zip file you extracted contains all the profiles for various servers that PIA use. I personally use a UK one but you can use anything, for this example i will use the UK London profile.
sudo cp "UK London.ovpn" /etc/openvpn/pia.conf
Navigate to the OpenVPN install location
We need to create a login conf file, this way you can keep your username and password out of the configuration files.
sudo nano login.conf
Type your PIA username and password on seperate lines and save the file (normally Ctrl+O)
Change the permissions on the file so all users can read the file (this step might not be needed but its what i do)
sudo chmod 755 login.conf
sudo cmod 755 pia.conf
Edit the pia.conf file for the PIA connection
sudo nano pia.conf
At the bottom add the following line
The file should look similar to this (the remote line will be different based on the profile you used)
remote uk-london.privateinternetaccess.com 1198
Before we start the VPN connection its best to check your current external IP, you can do this by running
Note the returned IP address, now start the VPN by using the following command
sudo systemctl start email@example.com
Run curl ifconfig.co command again and see if the output is different. If it is then great you are connected, if it isnt then something isnt right and i would suggest reviewing the steps above.
If you wish to run this upon boot then use the below command
sudo systemctl enable firstname.lastname@example.org
To disable running this at startup run this command:
sudo systemctl disable email@example.com
You can also run openvpn interactively by running
Running it interactively is useful to diagnose problems but obviously you can call it from a script.