Home Linux ServerTools How to install OpenVPN on Ubuntu 20.04

How to install OpenVPN on Ubuntu 20.04

by Thạch Phạm
Published: Last Updated on

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.

openvpn hoat dong

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:

anh 68

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.

anh 69

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

anh 70

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

anh 71

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.

z3399057036325 a77043fcb6cf2726b7784e4cec4ebcbd

Then you click ADD to add the file.

z3399057041254 5b1a6846afdf41355f97e647b27ee498

Next, select Connect after import => ADD.

z3399057042797 0816b959ad2baf8798a2a37c3e8d6d88

And below is the result after accessing:

z3399057047384 069bd6a975a0110daa9a8da2922bdd94

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.

CleanShot 2022 05 08 at 20.10.04 1

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á

Tham gia nhóm hỗ trợ Server - Hosting

Tham gia nhóm Hỗ trợ Server - Hosting & WordPress để cùng nhau hỏi đáp và hỗ trợ các vấn đề về WordPress, tối ưu máy chủ/server.

Tham gia ngay

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