Home Linux ServerTools How to install OpenVPN on Ubuntu 20.04

How to install OpenVPN on Ubuntu 20.04

by Thạch Phạm

What is OpenVPN?

OpenVPN is a completely free open-source VPN program. OpenVPN is also considered the best solution for those who want a safe and secure connection between two networks.

OpenVPN allows secure point-to-point connections in routed or bridged configurations and remote access facilities. It uses a custom security protocol based on SSL/TLS to establish an encrypted connection on the Internet. And currently, at AZDIGI, the techniques have been deployed and used for the most security.

Steps to install OpenVPN


  • Linux server (In this article, I will install on Ubuntu version 20.04)
  • Public IP

To install OpenVPN, follow these steps:

Step 1: Update the system

Before installing, I will update the system packages to the new version.

AZDIGI Tutorial
sudo apt update
sudo apt upgrade

Step 2: Download and install OpenVPN from the script

You download the script, then authorize and run the installation.

AZDIGI Tutorial
wget https://git.io/vpn -O openvpn-ubuntu-install.sh
chmod -v +x openvpn-ubuntu-install.sh
bash openvpn-ubuntu-install.sh
install OpenVPN on Ubuntu 20.04

Then you will be asked to enter some information, including:

  • Client name: Set the user name for the OpenVPN account
  • Select configuration protection
    • 1) Add a passwordless client: Don’t set a password for the configuration file
    • 2) Use a password for the client: Set a password
install OpenVPN on Ubuntu 20.04

To create a new account, run the bash openvpn-ubuntu-install.sh command again and set it up as in step 3 and there are menus like:

  • 1) Add a new user
  • 2) Revoke existing user
  • 3) Remove OpenVPN
  • 4) Exit
AZDIGI Tutorial
root@vpn:~# bash openvpn-install.sh
Welcome to OpenVPN-install!
The git repository is available at: https://github.com/angristan/openvpn-install

It looks like OpenVPN is already installed.

What do you want to do?
   1) Add a new user
   2) Revoke existing user
   3) Remove OpenVPN
   4) Exit
Select an option [1-4]: 1

Step 3: Download the configuration file to your computer

With step 2, you can connect and use OpenVPN. However, I will write this extra step to help you download the configuration file directly from the browser to the client’s computer. To do this, please run the following command:

AZDIGI Tutorial
root@vpn:~# cd /root && python3 -m http.server
Serving HTTP on port 8000 ( ...

Then you access the browser, enter server-ip:8000 to view the configuration file and download it. If you do not have access to port 8000, then the port is not open on the firewall system. Please refer to the following article to open it:

Step 4: Set up & use OpenVPN

To use a VPN on your computer or mobile phone, you must install VPN Client to connect. Some software for each operating system, such as:

1. Set up using OpenVPN on your computer

1.1 Configuring OpenVPN on Windows

After installing the OpenVPN app on Windows and downloading the *.opvn file, copy this file and move it to C:\program File\OpenVPN\config

1.2 Configuring OpenVPN on MacOS

With the configuration on MacOS, I use an app called OpenVPN to set up a VPN. You select the + icon to add a new account.

Next, you click FILE => BROWSE => .opvn file. .opvn

Then you press CONNECT button. If asked for a password, enter the password you created in the first step.

2. Set up & use OpenVPN on mobile

OpenVPN has support on mobile devices as well. To download, please visit the corresponding link below:

Please download the .opvn file to your mobile device => open this file with the installed OpenVPN application.

Then you click ADD to add the file.

Next, select Connect after import => ADD.

And below is the result after accessing:

Step 6: Check the internet connection

After the connection is complete, I will access the Internet to check if it works and if the IP is correct.

So AZDIGI has completed the steps to install OpenVPN on Ubuntu 20.04. Wishing you success!

See more:

If you need assistance, you can contact support in the ways below:

Đánh giá

Bài viết cùng chuyên mục

AZDIGI – Không chỉ là đơn vị hàng đầu trong lĩnh vực Web Hosting và Máy chủ, chúng tôi mong muốn mang lại những kiến thức bổ ích nhất và luôn cập nhật thường xuyên cho cộng đồng người đam mê thiết kế website, công nghệ,…

Vui lòng không sao chép nội dung nếu chưa xin phép. Designed and Developed by PenciDesign