Knowledgebase How to set up OpenVPN on Ubuntu VPS server

mercury

New member
Jan 15, 2020
21
6
3
17
Commands you need to type will be underlined and the output will be italic.
If theres a problem please comment down below.

The reason why you might want to make a openvpn server is
1: You have full access to your data so no "logging" stuff normal VPN websites do (even on paid ones).
2: It's way cheaper to buy a small vps (im running mine on 512mb ram and it works fine, contact staff for more info) and installing an openvpn yourself
then to buy a vpn service.
3:You can manage the server so if you are techy enough you could customize it to make it a secure connection to your work or as a firewall.

First you need:
1: a SSH connection to the server you desire
2: SFTP connection to the server so you can download the config files
3: server running Ubuntu 20.04 18.04 16.04 (personally tested on 20.04)

Step 1.

Connect to your server via SSH connection.
username: root
password will be emailed to you.
remember paste is right click and password will be hidden so do not press right click multiple times.
im using PuTTY for this example.

the screen should look like this:
systut1.PNG


Step 2. (installation of the OpenVPN).

run the following commands to update and upgrade your system packages.

sudo apt update

sudo apt upgrade

systut2.PNG


type in Y for yes and enter to confirm.

it will spam the screen but wait for the " #######........... " progress bar to finish.

Step 1.1 (installing the git).

Install git by running the following command:

sudo apt-get install git

If prompted to confirm type Y to confirm.

If already installed then skip to next step.

Step 1.2 (cloning the OpenVPN-install repository).

Now git is installed we now need to download the OpenVPN install repository.

return to your home directory by:

cd ~

now clone the OpenVPN-install repo by:

git clone https://github.com/Nyr/openvpn-install.git

Step 1.3 (installing OpenVPN and configuring for the first client)

Change the directory to openvpn-install by:

cd openvpn-install/

Now do:

chmod +x openvpn-install.sh

To make the file executable.

Next to run the file aka the installer run the command:

sudo ./openvpn-install.sh

First, enter 1.

Second, enter 1194.

Third, enter 1.

Finally enter the name of your choice.

It should look like this:
systut3.PNG


Press enter to continue.

This should be the result:

systut4.PNG

Make sure to screenshot or write down the location so you do not forget where it is.

Step 2. (installing OpenVPN client on your pc and connecting to the server).

Go to https://openvpn.net/community-downloads/ and download 64 bit windows msi installer.

Install it as you would install a normal program .

This little icon on the toolbar will show (on taskbar).
systut5.PNG


Open up the SFTP program of your choice and navigate to the client config file shown eariler.

Download the config file and put it in the directory " C:\Program Files\OpenVPN\config "

Right click on it and click "start OpenVPN with this config file" option
1599369295511.png


Congrats now you have finished your VPN