How to Install OpenVPN on Ubuntu 20.04
What is OpenVPN?
OpenVPN is known as a completely free and open source VPN program. OpenVPN is also considered the best solution for those who want a safe and secure connection between two networks.
With 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.
In this article, we will show you how to install OpenVPN on Ubuntu 20.04
Steps to install OpenVPN
Request:
- Linux server ( Ubuntu version 20.04 )
- IP Public
To install OpenVPN, follow these steps:
Step 1: Update the system
Before going into the installation, I will update the system packages to the new version.
sudo apt update sudo apt upgrade
Step 2: Download and install openvpn from script
Then you download the script, then authorize and run the installation.
wget https://git.io/vpn -O openvpn-ubuntu-install.sh (If it fails to load, you can download the script from the link above and upload it to the VPS server)
chmod -v +x openvpn-ubuntu-install.sh
bash openvpn-ubuntu-install.sh
You will then be asked to enter some information including:
- Name {client} : Set the user name for the OpenVPN account
To add or remove a new client, run the command again bash openvpn-ubuntu-install.sh
and set it up as in step 3, and there are menus like:
- 1) Add a new user: Add a new User
- 2) Revoke existing user: Delete User
- 3) Remove OpenVPN: Delete OpenVPN
- 4) Exit: Exit
Step 3: Download the configuration file to your device
With step 2, you can use and connect. However, I will write this extra step to help you download the configuration file directly from the browser to the client computers. Please run the following command to execute
cd /root && python3 -m http.server Serving HTTP on 0.0.0.0 port 8000 (http://0.0.0.0:8000/) ...
Then you access the browser, enter server-ip:8000
to view the configuration file and download it. If you can’t access the port 8000
, the port is probably not open on the firewall system. Please refer to the following article to open
Step 4: Set up using OpenVPN
To use VPN on your computer or phone, you must make VPN Client settings to connect. Some software for each operating system such as:
1. Set up using OpenVPN on your computer
- Windows: OpenVPN Client for Windows
- macOS: TunnelBlick or OpenVPN
1.1 Configuring OpenVPN on Windows
After installing the OpenVPN app on Windows and downloading the file *.opvn
, Open the newly installed OpenVPN App. Then you select FILE and select BROWSE and select file.opvn and click connect
1.2 Configuring OpenVPN on MacOS
With the configuration on MacOS, I use an App called OpenVPN to set up a VPN.
Then you select FILE and select BROWSE and select file.opvn
Then you choose CONNECT to connect. If asked for a password, enter the password you created in the first step
2. Set up using OpenVPN on mobile
OpenVPN also supports mobile devices. To download, please visit the corresponding link below.
- iOS: OpenVPN Connect for iOS
- Android: OpenVPN Connect for Android
Please download the .opvn file to your mobile device. Then open this file with the installed OpenVPN application
Then you choose ADD to add the file.
Next you choose Connect after import (Connect after import) => ADD
Similar to VPN connection on MAC OS.
Step 5: Check Internet connection
After the connection is complete. Now I will access the Internet to check if it works or not. And I check if the IP is correct or not.
How to start / stop / restart the OpenVPN server?
To stop, run:
$ sudo systemctl stop [email protected]
To start, run:
$ sudo systemctl start [email protected]
To restart, run:
$ sudo systemctl restart [email protected]
To display status, run:
$ sudo systemctl status [email protected]
Summary
So I have completed the OpenVPN Installation Guide on Ubuntu 20.04. Wishing you success.