DEV Community

Thien DX
Thien DX

Posted on • Originally published at Medium on

Set up your own VPN with OpenVPN and DigitalOcean

What is a VPN and why you need it ?

VPN — Virtual Private Network, allows you to create a secure connection over the public Internet to private networks at a remote location.

A VPN can provide protection if you are traveling or using untrusted WiFi networks as all your traffic will be going through an encrypted tunnel, it also provide some privacy bonuses since websites you connect to won’t know your starting location and IP.


OpenVPN is an open-source commercial software that implements virtual private network (VPN) techniques.

Set up OpenVPN on DigitalOcean

Since we are going to host our own VPN, first we need a server, and DigitalOcean is easy to start with, you can also try AWS or Google Cloud if you want more options.

Sign Up for DigitalOcean account with the following URL to get $100 credits. (and yes, it’s my referral link)

Step 1 : Creating cloud server with OpenVPN enabled on DigitalOcean_

After you create your account, go straight to CREATE > DROPLETS to create a “droplet” — cloud server.

You don’t need to start fresh on a new Ubuntu, there’s already an image that support OpenVPN. Marketplace > choose OpenVPN Access Server.

For personal or family usage, the cheapest plan with 1TB data should be enough and it costs only 5$/month; Remember ? With my referral link you got 100$ credit.

For region you will want to choose the closest.

For Authentication, since you are going to create your own VPN, I assume you should have fundamental technical background and care about privacy, please choose SSH. If you have not had a pair of public-private key yet, please check ssh-keygen for Ubuntu or PuTTy for Window.

Step 2 : A little configuration

On the MANAGE panel, go to Droplets > Click on your droplet.

You may want to wait a bit if it’s showing the droplet is being created, once it’s ready, you can proceed.

  1. Log on via SSH to start the setup procedure, you will be asked a number of questions that need to be answered, mostly you can just use default by pressing Enter.
  2. Once that is complete, enter the command “passwd openvpn” to set a password for your Access Server.
  3. Now open the address of your server in a web browser https://your_droplet_IP/admin/, for example:
  4. If you see any SSL certificate warnings, that is normal, proceed anyway.
  5. Now log on with username ‘openvpn’ and the password you set.

OpenVPN Access Server is ready, you can now add more users if you want to share this VPN with friends by adding users in the User Permissions table.

Step 3 : Almost done, just the client left

Go to https://your_droplet_IP, there’s no “/admin” part this time.

Download the suitable version of client for your OS.

After installing the client, go ahead and open it to find the Access Profile already there for you, turn it on > Enter username +passwords that you set in User Permissions table of the admin tools, THAT’S IT.

Now you can enjoy your very own self-hosted VPN.

You can double check if everything is working by , it should point to your droplet IP.

Top comments (1)

vpnprogramlari profile image
VPN Programları

Good idea 💡