- Update
sudo apt-get update -y
sudo apt-get upgrade -y
- Install OpenVPN
sudo apt-get install openvpn -y
- Go to the OpenVPN folder
Use the command cd .. as many times you need to get into the root folder.
Then type the command cd /etc/openvpn - Download PIA connection files
sudo wget https://www.privateinternetaccess.com/openvpn/openvpn.zip
- Install unzip if you awlready don’t have
sudo apt-get install unzip
- Unzip downloaded files
sudo unzip openvpn.zip
- List files unziped
ls -l
- Config OpenVPN with the server file you want (in this example mexico)
sudo openvpn config-sever-mexico.ovpn
- Create a text file with your PIA user and password
sudo nano pass.txt
insert your username and password like this:
username
password
press Ctrl+O then Enter - Protect your pass.txt file
sudo chmod 400 pass
.txt - Add the pass.txt to your .ovpn file
sudo nano mexico.ovpn
in the botton of the file insert this:
auth-user-pass pass.txt
press Ctrl+O then Enter - Lets rename the chosen file to client.conf
sudo cp /etc/openvpn/Mexico.ovpn /etc/openvpn/client.conf
- Setup OpenVPN auto start on boot
sudo nano /etc/default/openvpn
find and remove the “#” in front of AUTOSTART=”all”
press Ctrl+O then Enter
sudo systemctl enable openvpn@client.service - Start OpenVPN
sudo service openvpn@client start
- Install curl if you don’t have it
sudo apt install curl
- Test the VPN with
curl ifconfig.co
or
dig +short myip.opendns.com @resolver1.opendns.com
The result should be a different IP than yours, you can check your IP here in a device who don’t have a VPN actived
https://whatismyipaddress.com/ - Eventually you will need to update the connection to the PIA, to do this follow these commands:
sudo service openvpn stop
cd ../../etc/openvpn
sudo wget https://www.privateinternetaccess.com/openvpn/openvpn.zip
sudo unzip -o openvpn.zip
sudo nano mexico.ovpn
–add at end: auth-user-pass pass.txt
sudo cp mexico.ovpn client.conf
sudo systemctl daemon-reload
sudo service openvpn@client start
test your connection