Installing OpenVPN Server – Ubuntu 18.04

OpenVPN is a popular open-source solution in setting up a fast VPN server as it’s pretty simple to do so. For this tutorial, we will be using a script to set up pretty much everything removing the need for much manual work in general.

OpenVPN is the name of the open source project started by our co-founder. OpenVPN protocol has emerged to establish itself as a de- facto standard in the open source networking space with over 50 million downloads. OpenVPN is entirely a community-supported OSS project which uses the GPL license.


Hosting – VPS

Frist, you need to find a host which sells Ubuntu Virtual Private Servers. This is often easy to find, but it’s difficult finding the one which the right balance of price and support / usability. For our tutorial, we will be assuming you will be using a host which already does the pre-setup for the user. We will also provide VPS services that we recommend.

Server Space

Updated on 26/10/2020

We have used Server Space before, and had a great experience using them. Their prices are cheap and flexible. However, the support may not be as quick as other services. We also have no downtimes with their services and overall had a great experience with them.

Creating The Server

Server Space allows users to create servers within 2 click, follow along

Click on create then create server

After clicking on create, they offer a few options, however, we will stick to these options

Make sure to select the ubuntu 18.04 x64

After creating a server, they should redirect you to their control panel. This step if really up to you, but you can choose to either use PuTTY or use their own web console. i Would recommend using Putty, since it’s easier to copy and paste commands and overall it’s much faster.


Before anything, make sure to run the standard commands just to make sure everything is updated

sudo apt update
sudo apt upgrade

After doing that, make sure to locate the IP address of your server. You can do this in many way and if you are using a hosting service, they will usually show the server’s IP in their control panel

Server Space
For Server Space users, the IP of the server is located under your server list
Other Hosts

If you use other hosting services, the server’s IP should be quite easy to locate. If you are lost to where it is, it is usually the same IP you use for your SSH connection ( PuTTy ), if you are using their web console and still cant find the server’s IP address, here is how.

sudo apt install curl

This will be the IP address your VPN will be connected to, so keep that in mind. If you are running the script in a older version ubuntu or using a older version of the script, you may need to enter your IP address if they request for it

Downloading/Running Script

Since we will be using a script to run everything, let us setup a folder for files we will download and run.

mkdir /home/openvpn

Then let us hop into the folder

cd /home/openvpn

Alright, once we are done doing all that, let us download the script into the folder we just created

wget -O

Your output should something like this, if you face any errors on trying to download the file, make sure to check if you can even connect to the website, you are unable to do so, make sure the website is operating. If you still are having issues, you can use this link instead of the one provided above

Once the script is downloaded, let us set up permissions on the file using the chmod command and add a “execute” flag on the script

chmod +x

If you like to take a view inside the script yourself, you can do so by using either nano or any editor of your choice


If everything is fine, let us run the script by running the following command

sudo bash ./

Now it should look something like this

Choosing A Port

You now should look at a port to choose from, we will provide you with two ports that you can choose depending on what situation you are in

  • Port 443 ( TCP ) – You can use Port 443, which is HTTPS, for your VPN if, for some reason, something is blocking your usual VPN port. Usually, from our experiences, in schools or working environment, they tend the block the usual port. If that’s the case, or if you are planning on using the VPN in school or at a workplace, you should use port 443
  • Port 1194 ( UDP ) – This is the usual port you should use if you are planning on using the VPN at home or at a place where they do not block this port.

We will be choosing Port 443. Here is the end configuration

Once you are done with the configuration, just press ENTER and let the script do the work for you. You should see something like this

While the script is setting up everything, here are some useful commands if you ever need to restart, stop or start the server

Stop Server
sudo systemctl stop [email protected]
Start Server
sudo systemctl start [email protected]
Restart Server
sudo systemctl restart [email protected]
Status of Server
sudo systemctl status [email protected]

Once the script is finished doing it’s thing, we will get an output like this

We will try to organize things a bit more by creating a few subdirectory for all the clients we create, we can do this by running a simple mkdir command

mkdir /home/openvpn/clients

After creating this subdirectory, we will move the brand new client we have created into it by running a simple mv command

mv /root/Laptop-Con.ovpn /home/openvpn/clients

You can now download the file that was created, for us it was Laptop-Con.ovpn and since we moved it, it will be in /home/openvpn/clients. If you have named your client name differently or folder differently, then you can change it accordingly.

Download/Use Client File

Download Created Client


Download WinSCP from their official website, and run it. You should be greeted with this

Fill in your server’s details. Once you have done so, you will see your server’s files on the right and your local files on the left. Locate your client folder and download the files needed.


On Linux Os use command-line tool scp like this. From remote host to localhost

scp [email protected]:foobar.txt /some/local/directory

From localhost to remote host (you have to specifiy the absolute path)

scp foobar.txt [email protected]:/some/remote/directory

OpenVPN Setup

Here are the download links for OpenVPN

  1. Apple IOS Client
  2. Android Client
  3. Apple MacOS Client
  4. Windows Client

Linux Client

For Linux, download the OpenVPN package by running the command provided

sudo apt install openvpn

You can then copy the client file that you have downloaded into OpenVPN’s folder by running the command

sudo cp Laptop-Con.ovpn /etc/openvpn/client.conf

After copying, now run OpenVPN using that config file by using this command

sudo openvpn --client --config /etc/openvpn/desktop.conf

If you have restarted your server or if anything had happened which had stopped the OpenVPN service, you can start it by running this command

sudo systemctl start [email protected]

Adding/Removing Clients

If you would like to remove or add clients to your OpenVPN server, you can re-run the same script and it should prompt like this

sudo bash ./


And, that’s basically how easy it is to add or remove clients.

Leave a Reply