Featured Image

Notice! This page is old and the script is out of date. You can find a good community supported setup script here.

A VPN (virtual private network) server sits between you and the internet. This means anyone looking at your activity does not see your identity, but that of the server. We will set op an OpenVPN server for our private use.

In essence I'll show you how to set up a VPN server using these steps:

  1. Buy a $5/month server
  2. Configure the server to act as a VPN
  3. Connect to the VPN server you created Stuff you need to know:
  • Anyone who has a basic understanding of the internet can do this
  • This takes between 5 and 30 minutes depending on you
  • This server will use AES-256 encryption and has no bandwidth limitations

Buying a VPS

 Digital Ocean

Creating an account

A VPS is a Virtual Private Server, not to be confused with a VPN which is a Virtual Private Network. In essence:

  • A VPS is a server, so a computer you hire in a datacenter
  • A VPN is a server configured to act as a connection for you

A VPS costs $5/month. You will be billed per second used, so if you cancel your server after a day, you will pay next to nothing. No contracts. I recommend using Digital Ocean as your VPN provider. Simply:

  1. Go to DigitalOcean
  2. Create an account
    1. Either use the big form on the front page
    2. Or use the 'sign up' button in the right top corner
  3. Fill in your payment details (remember, you can cancel any time and you are billed per second)

Creating a server

Digital Ocean (DO) calles their VPS servers droplets. We are going to spin up a droplet:

  1. Log into your client panel
  2. Click 'create droplet'
  3. Give it any name (no spaces)
  4. Choose the $5/month option
  5. Select Amsterdam as your VPS region (better net neutrality laws)
  6. Select Ubuntu 15.04 x64
  7. IF you use SSH keys input them as well. If you have no idea what I'm talking about ignore this You will receive an email containing the following:
  • Your server IP (a number like
  • Your root password (unless you use SSH keys, in which case you won't)

Connecting to your server

First we need to log into your server. This is done through something called an SSH connection. This is just a protocol for logging in.

On Mac computers

  1. Open your spotlight/search and type 'Terminal'
  2. Open the terminal (looks like a black screen icon usually)
  3. In the terminal type "ssh root@your_ip" for example ssh root@
  4. You will be asked for a password, this is the one that was emailed to you

On Linux computers

  • You probably know your way around a terminal already
  • Use the same instructions as on a Mac

On Windows computers

You need an extra piece of software to do ssh connections. It's not built in. Sorry.

  1. Download and install Putty
  2. Open Putty
  3. Under 'Host Name' put your IP address
  4. Set 'Connection type' to ssh
  5. Press 'Open'
  6. Now a black screen will open asking for a username. Use 'root'
  7. You will be asked for a password, this is the password emailed to you

Updating your server

I like starting with an updated server. Latest software and security etc. This is not strictly needed (the script in the next section also does it) but it is a nice exercise in case you have not handled a command line before. Anything you type into the terminal now that you started the ssh connection is a command.

Update your repositories

This is checking if your update sources are up to date. It is step 1 of 2. Type the following:

sudo apt-get update

And press enter. A lot of stuff will start happening. Relax, it's supposed to happen.

Update your software

This is the updating of your actual software. Step 2 of 2 in the update process. Type:

sudo apt-get upgrade

Answer yes when the terminal asks you whether it is ok to install the new software.

Installing the VPN software

I wrote a script to install OpenVPN. This article actually started as a "copy this and then paste that" kind of thing, but it resulted in chaos. Therefore we will do 2 versions, the simple and advanced. What this script does is:

  • Install OpenVPN
  • Set up a firewall that allows only SSH, 1194 UPD and 443 TCP¬†ports
  • Configure 2¬†connections for the server
    • Both using AES-256
    • Both using a ta.key handshake
  • Generate 2 client files (used by us to connect)
  • Configure automatic security updates

If you don't know what you are doing

In your terminal type the following commands, you may copy paste:

  1. wget -O openvpn.sh <removed this script because it is old, see notice on top of article)
  2. sudo bash openvpn.sh
  3. // Input your password if you are asked for it
  4. Wait until you get a reboot notice, this will take a while