Skip to Main Content

Navigation

How to Install OpenVPN on your Ubuntu or Debian Server or PC

Knowledgebase/cloud/how-to-install-openvpn-on-ubuntu-or-debian-server

OpenVPN is the most popular open-sourced VPN or virtual-private-network library available and can be used for any task to your liking, here's how to install it on your Ubuntu or Debian Server in a few easy steps!

Install the OpenVPN application onto your OS

In this article, we'll be using a fantastic installation script for OpenVPN created by Nyr, to start you will have to access your server's bash shell through SSH or optionally using the VNC viewer located in your dashboard.

Firstly, run the following command to download the installation script to your file system:

wget https://raw.githubusercontent.com/Nyr/openvpn-install/master/openvpn-install.sh -O openvpn-install.sh

Now you should always verify that scripts you download from the internet are safe and won't harm your system. It's generally a bad idea to run arbitrary software from the internet and so, at the very least, we should make it a habit to inspect it before running. Do this with the nano command which will open the NANO text editor, as shown below, or alternatively with your editor of choice (e.g. vim).

nano openvpn-install.sh

Alas we begin the installation process itself by running these two commands:

First run: sudo chmod +x openvpn-install.sh

Then: sudo bash openvpn-install.sh

After such, your console screen will be greeted with the 'OpenVPN road warrior installer', which looks something like this:

Welcome to this OpenVPN road warrior installer!
Which protocol should OpenVPN use?
  1) UDP (recommended)
  2) TCP
Protocol [1]: 1
What port should OpenVPN listen to?
Port [1194]:
Select a DNS server for the clients:
  1) Current system resolvers
  2) Google
  3) 1.1.1.1
  4) OpenDNS
  5) Quad9
  6) AdGuard
DNS server [1]: 2
Enter a name for the first client:
Name [client]: iphone
OpenVPN installation is ready to begin.
Press any key to continue...


In Protocol put 1, Port: any will do, we recommend 1194 as it's the default one, choose a DNS resolver that fits (Google works almost always) and finally a name for the device, then press any key to continue on with the install.

You are all done with the installation process! Now we've come to the networking sector, for this we will be using the KUBBUR Cloud Management Interface on a KUBBUR VPS Server which makes it 10x easier to configure networking rules.

All that you need to do is go to your firewall manager like so:

Press "FIREWALL"

Then select "NEW RULE"

And fill in: Name can be anything you want (OpenVPN port for example), Source IP is the IP that is allowed to connect to the port (you can restrict this to your own IP for example, leave blank for no restriction), Destination IP should be the IP of your Virtual Server and Protocol is set to 'UDP', Source Port to as previously noted whatever you want to restrict it to (leave blank for no restrictions) and the Destination Port to whichever port you chose as your OpenVPN port in the installation process (we recommended 1194), and Action is set to "ALLOW".

After creating the rule, you might want to maximize the DDoS mitigation potential of your OpenVPN install so go back to the "Firewall" section and click on "Filters".

Press "Add filter" under the "OpenVPN UDP server" section and set the Destination IP to the IP of where OpenVPN is pointed to (by default this is your server's default IP address, which is only important if you have multiple IP addresses), then set the port field to 1194 or whichever port you chose in the OpenVPN installation and that's it!

Note: the rules & firewall may take 10-15 minutes to apply.

You're all done, you've installed OpenVPN Server-side on your Ubuntu or Debian Install!

Need more help?

Speak to our support team to help you with your problem!

let's talk!
KUBBUR Logo

Made with ❤️ in Iceland

Copyright © 2021 - 2022 KUBBUR Limited. All rights reserved. KUBBUR is a brand of KUBBUR Limited, a duly registered company of England and Wales. Company no. 13999809. ICO no. ZB331924.

Minecraft® is a registered trademark of Mojang AB. This website is not affiliated with or endorsed by Mojang AB. Discord®, the Discord® logo and Discord Nitro® are registered trademarks of Discord, Inc. Ubuntu®, Kubuntu®, Lubuntu®, Xubuntu®, Canonical®, the Ubuntu® logo and the "Circle of Friends®" are registered trademarks of Canonical, Ltd. Intel®, and the Intel® logo are registered trademarks of Intel Corporation and its subsidiaries. AMD®, AMD Ryzen®, the AMD® and AMD® arrow logo, AMD EPYC®, and the AMD Ryzen® logo are registered trademarks of Advanced Micro Devices, Inc. Apex Hosting® is a registered trademark of Apex Hosting, LLC. MCProHosting® is a registered trademark of MCProHosting, LLC. PebbleHost® is a registered trademark of Daniel James Jackson.

All product names, brands, logos, trademarks and registered trademarks are property of their respective owners. Any use of the aforementioned on this website is for identification purposes only and does not imply endorsement.

KUBBUR Limited is a subsidiary of KVM Group Limited and Scaleblade, Ltd. of the United Kingdom.