To stop people snooping on what we are doing on the internet or when restrictive governments prevent people from accessing popular websites you can use a VPN to protect your privacy and allow you to access the internet without restrictions.
Most VPN providers provide simple step-by-step instructions to get VPN set up on most operating systems but many fail to give instructions about how to autostart a VPN in a non graphical environment.
The following will work with the files provided by most VPN providers with a couple of small changes:
Get the Files from your Provider
Of course, the url that your provider uses may be different:
$ cd /tmp $ wget https://www.privateinternetaccess.com/openvpn/openvpn.zip $ unzip openvpn.zip
Copy Certificates to /etc/openvpn
$ cp ca.crt /etc/openvpn/ $ cp crl.pem /etc/openvpn/
$ vi /etc/openvpn/login.conf
The file should contain the following:
$ chmod 400 /etc/openvpn/login.conf
Point OpenVPN Towards the Right Files
The .ovpn files may not be by country so substitute them as appropriate.
$ vi Country.ovpn
Prefix the pem and crt paths with
Change the auth-user-pass line to read
$ cp Country.ovpn /etc/openvpn/Country.conf
Autostart the VPN
"Country" is the name of your .conf file without and extension so in my case Country.conf (see the previous steps).
$ vi /etc/default/openvpn
Check that Autostart is Working
To check if the VPN is running open lynx and go to google.com. It should take you to the specific countries site.
That is it, you are done!