OpenVPN Setup on Ubuntu 18.04 LTS

I could not remember exactly when I setup OpenVPN for the first time. As far as I remember, it was not an easy task. But, I need to have it installed, and I found it easier. Probably, because it’s easier to setup on Ubuntu 18.04 LTS?

I need to have it setup because I have some sites blocked by my internet provider. Using Google’s DNS (8.8.8.8) or even ClouFlare’s 1.1.1.1. did not help either. Changing the DNS made my internet connection do not work.

So, I need to set OpenVPN up somewhere. I was thinking of having it setup on my own cloud server at Linode. Lucky that there is a straight-forward tutorial on how to setup OpenVPN on Ubuntu 18.04 LTS. I will write it down also here for my personal documentation.

Installation

First, update the system by running apt-get update and then apt-get upgrade. For me this is optional.

Next, download open install script by running wget https://git.io/vpn -O openvpn-install.sh and give it the right permission by running chmod +x openvpn-install.sh

Welcome to this OpenVPN "road warrior" installer!

I need to ask you a few questions before starting the setup.
You can leave the default options and just press enter if you are ok with them.

First, provide the IPv4 address of the network interface you want OpenVPN
listening to.
IP address: X.X.X.X

Which protocol do you want for OpenVPN connections?
   1) UDP (recommended)
   2) TCP
Protocol [1-2]: 1

What port do you want OpenVPN listening to?
Port: 1194

Which DNS do you want to use with the VPN?
   1) Current system resolvers
   2) 1.1.1.1
   3) Google
   4) OpenDNS
   5) Verisign
DNS [1-5]: 2

Finally, tell me your name for the client certificate.
Please, use one word only, no special characters.
Client name: vpn-client-name

Okay, that was all I needed. We are ready to set up your OpenVPN server now.
Press any key to continue...

Pressing any key will start the installation. It should take few seconds only. Once completed, we will have this message:

Your client configuration is available at: /root/vpn-client-name.ovpn. 
If you want to add more clients, you simply need to run this script again!

The .ovpn name depends on the input on ‘Client name’ field during installation. Now, we just need to download the client configuration file.

Using OpenVPN on Mac and mobile phone

To run it on my Mac, I use Tunnelblick as my OpenVPN VPN client. It’s easy to use to manage the configurations and connections. After having it installed, just run the .ovpn file and follow the setup instruction.

On mobile, I use OpenVPN for Android. The setup is also easy. As long as we have the configuration file, just open the app and follow the instruction.

I tried the installation above on my cloud server account at Linode. I think it should work also for other provider like DigitalOcean.