OpenVPN SSL Setup on Linux (Ubuntu) via Terminal

Share This!

The instructions below are handy if you only have access to a Linux machine via terminal or just prefer to use it rather than launching it via GUI. While this is written on a Ubuntu machine, the principal are the same throughout all Debian distributions.

 

Note: You need to run most command as a super user, so please ensure that you have sudo (root) access before proceeding.

 


1) Ensure your package is up to date on your system. Run the command below:

 

sudo apt-get update

 


2)  Install the OpenVPN client package:

 

sudo apt-get install openvpn

 


3) Confirm OpenVPN package is installed on the system and check the version using a single command:

 

openvpn –version

 

If the version is higher than 2.3.4, proceed as Step #4

 

If it’s lower than version 2.3.4 even after the updates, most likely the available repositories for your distribution is not supported anymore. In this case, simply get the OpenVPN package from their own official repositories by running these commands (as root) below:

 

wget -O - https://swupdate.openvpn.net/repos/repo-public.gpg|apt-key add -

 

echo "deb http://swupdate.openvpn.net/apt <OSRELEASE> main" > /etc/apt/sources.list.d/swupdate.openvpn.net.list

 

 Note: Change OSRELEASE to your distribution code name i.e;

 

trusty (Ubuntu 14.04)

xenial (Ubuntu 16.04)

jessie (Debian 8.x)

 

This will add the swupdate.openvpn.net apt repository to your system and you can proceed with the installation again as per Step #2

 


4)  Go to your home directory or to a folder where  you wish to keep the configuration and download the required files below:

wget www.mypn.co/files/linux/mpnvpn.ovpn

wget www.mypn.co/files/linux/user.txt

 

 Edit the mpnvpn.ovpn file as below;

 

vi mpnvpn.ovpn

 

remote COUNTRY.mypn.co
to be
remote GBR.mypn.co

 

If you wish to connect to another country, please see the full list of available server names and countries you can connect to in our article below:

Which Countries Can I Connect To?

Save the changes and edit the user.txt file as below;

vi user.txt

 

USERNAME to be your My Private Network Username

PASSWORD to be your My Private Network
Password

Save the changes and exit the editor.


5) Connect to the VPN

openvpn mpnvpn.ovpn

 

The command above will run the connection in the foreground, so closing it will terminate / disconnect the session.

 

To confirm if you are indeed connected and getting our VPN IP address, open your browser and head on to My Private Network IP Info page to check your IP address.

 

Press Ctrl + C to disconnect the active session.

 

 


6) If you having any problems connecting, open another Terminal and run the command below before running the openvpn commands again to see where the connection is failing.

 

tail -f /var/log/syslog

 

Note: The location of the network connection log might be  different depending on your Linux distribution and version, check your distribution manual for more details.

 

If you continue to have problems or need any further information, please send us an email to [email protected] and we will do our best to assist you.