How to set up a personal VPN tunnel in 5 min

Hi, everybody. Today I will show you how to set up a personal VPN tunnel in 5 min. First and foremost, we need a server. I use Digital Ocean for this.

Digital Ocean Account

Register at Digital Ocean. In order to do so use my referral link and you will receive $10 on your digital ocean score. That will be enough for you for the two-month use of the Digital Ocean.

SSH

We will use ssh for easy connectivity to your droplet in the future. If you have the ssh key on your computer, then use the following command for copying it to the clipboard:
Create your first Droplet. Select One-click apps and select Docker in the list of apps. (I use Docker 17.06.0-ce on 16.04 for example)
If you don’t have the ssh key on your computer, then execute the following command to generate it and save it to the clipboard

ssh-keygen
pbcopy < ~/.ssh/id_rsa.pub

If you have the ssh key, then you should only execute the following :

pbcopy < ~/.ssh/id_rsa.pub

After that add your ssh key to your Digital Ocean profile. In order to do so go to Settings.

Select security tab in the setting screen and click ‘Add SSH Key’

Paste your ssh key into the dialog and add the name for it, For example, HOME_COMPUTER or WORK_COMPUTER.

Create Droplet

Create your first Droplet. Select One-click apps and select Docker in the list of apps. (I user Docker 17.06.0-ce on 16.04 for example)

Select a price model. I recommend using the cheapest one — 5$ per month. Then click “Create” in order to create your Droplet.
Check the Private networking box and the checkbox with the name of your ssh.

Click “Create” to create your Droplet.
After this, you can see the new Droplet in the Droplets page. It should look similar to this.

Configurate VPN

To connect to your droplet from your computer execute the following command:

ssh root@188.166.168.252

When 188.166.168.252 is IP Address of your droplet.

Then 188.166.168.252 becomes your IP Address of your droplet.

For creating your VPN server use following command (Thanks umputun for his docker container) :

CID=$(docker run -d --restart=always --privileged -p 1194:1194/udp -p 443:443/tcp umputun/dockvpn)

After the previous command is finished, execute the following command:

docker run -t -i -p 8080:8080 --volumes-from $CID umputun/dockvpn serveconfig

After a few seconds you will see https address in response from the command. Like this : https://188.166.168.252:8080/

Create VPN certificate

Put the https address from the previous step to address line.
Perhaps your browser will ask you about changing the https certificate, click continue. 
Rename the downloaded file to MyVPN.ovpn. It is your VPN certificate.

Connect to your VPN server

Install any VPN program on your computer. I will use Tunnelblick.
Open MyVPN.ovpn file in your VPN client program, in the Tunnelblick, you can drag and drop it. Wait several minutes until you get connected to your VPN server.