Skip to content

Instantly share code, notes, and snippets.

@evoactivity
Created January 29, 2023 21:54
Show Gist options
  • Save evoactivity/3f18bcdc748aaa0be5d11387775f1b44 to your computer and use it in GitHub Desktop.
Save evoactivity/3f18bcdc748aaa0be5d11387775f1b44 to your computer and use it in GitHub Desktop.
How to setup headless (No GUI/CLI Only) ubuntu openvpn pia
## Install OpenVPN
# Now we install and configure OpenVPN, do the following commands:
sudo apt-get install openvpn
cd /etc/openvpn
sudo wget https://www.privateinternetaccess.com/openvpn/openvpn.zip
sudo unzip openvpn.zip
# This next part, you can use whatever vpn connection you like, I use the netherlands for example, continue with the following commands:
sudo cp Netherlands.ovpn pia-nl.conf
sudo vi pia-nl.conf
# Change:
# auth-user-pass
# To:
# auth-user-pass login.conf
sudo vi login.conf
# Then in vi, press i for insert and paste the following:
# yourPIAusername
# yourPIApassword
# Then press the Escape key and type ":wq" without the quotes and hit enter.
sudo chmod 400 login.conf
sudo vi /etc/default/openvpn
# Add an AUTOSTART entry for pia-nl, .conf is not needed, do NOT put a # in front example:
# AUTOSTART="pia-nl"
sudo reboot -r now
# After the restart is done, you should be automatically connected to the VPN, check with the following command:
wget -q -O - ipecho.net/plain
# the output from that command should be an IP address, but it should NOT be YOUR PUBLIC IP ADDRESS, it should,
# in this example, be one of the netherlands IPs from PIA. As long as an IP shows up and it's not your own IP,
# you can assume everything is ok and continue.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment