OpenVPN on Ubuntu using Private Internet Access

I wanted to use a VPN on a Linux server (Ubuntu), using Private Internet Access, but without using the PIA client.

Steps

  1. Install OpenVPN (I also install curl and net-tools, as I frequently use both):

    sudo apt-get install openvpn curl net-tools
    
  2. Get necessary OpenVPN files from Private Internet Access, and copy local TEP (Tunnel End Point) config:

    curl -O https://www.privateinternetaccess.com/openvpn/openvpn-nextgen.zip
    unzip openvpn-nextgen.zip
    sudo mv us_denver.ovpn /etc/openvpn/client/openvpn.conf
    
  3. Verify public IP before connecting:

    curl ifconfig.me
    
  4. Connect to the VPN:

    sudo openvpn —config openvpn.conf
    
  5. Open a new terminal window/tab, and verify that you get a different IP address than in step #3:

    curl ifconfig.me
    
  6. Assuming everything works, terminal the VPN (control + c), then run the OpenVPN client as a service:

    sudo systemctl start openvpn-client@openvpn.service
    

    Note: If you name your config file differently, change the command above to match your config file name. For example, if your config files is called myconfigfile.opvn, then you would run:

    sudo systemctl start openvpn-client@myconfigfile.service
    
  7. Re-test the VPN connection, and if everything works, enable the OpenVPN client to start on boot:

    sudo systemctl enable openvpn-client@openvpn.service