How to run your own VPN server for free?

Nowadays, there are so many VPN providers (free or paid) that running your own instance is really not necessary and depending on your use case, might not even be any more private or secure.

This endeavour is purely for my own curiosity and for getting myself more familiar with DigitalOcean.

This tutorial is written for macOS but I’d imagine it wouldn’t be too different for Windows.

  1. Download algo, unzip the file and place it anywhere you like.
  2. Launch Terminal. Type the following into the Terminal and press enter (replace with the actual path).

    cd /path/to/algo-master

  3. Type the following and press enter.

    python -m ensurepip –user

  4. Type the following and press enter.

    curl | python

  5. Type the following and press enter.

    python -m pip install –user –upgrade virtualenv

  6. Type the following and press enter.

    python -m virtualenv env && source env/bin/activate && python -m pip install -r requirements.txt

  7. Type the following and press enter.

    chmod og-rw ~/.netrc

  8. Open the /algo-master/config.cfg file in your text editor. Add as many (or as few) users as you want.

  9. Go back to the Terminal window. Type the following and press enter.


  10. Enter ‘1’ to choose DigitalOcean.

  11. Sign up via my referral link to receive $10 free credit which is more than enough to run your VPN continuously for at least 1 or 2 months. After signing up, navigate to the ‘Applications & API’ page to generate an API key.

  12. Click ‘Generate New Token’.

  13. Enter whatever you want for the ‘Token Name’, it doesn’t really matter (I entered ‘algo’ for convenience sake).

  14. Click the token to copy it to your clipboard and paste it into the terminal and press enter.

  15. Name the vpn server whatever you want, again, it doesn’t really matter.

  16. For the region of your VPN server, it’s generally better to have a server that’s closest to where you are physically, as it will have a lower latency and better performance. However, if you are planning to utilise the VPN to get around geographically restricted content, make your choice accordingly.

  17. If you have no idea what the next few questions mean, just enter ‘n’ for all of them. Once you’ve answered all the questions, the installer will start the installation of your VPN server.

  18. Wait.

  19. Once setup is complete, DO NOT CLOSE YOUR TERMINAL WINDOW IMMEDIATELY. Take note of the p12 password.

  20. Navigate to the /algo-master/configs folder and you will find a new folder with a corresponding IP address. Inside, you will find a .mobilconfig file. Open it.

  21. You will be prompted to enter the p12 password and your macOS password.

  22. …and you’re done. You can now manage your VPN connection in your Network preferences.

15 June 2018