How to install OpenVPN on VDS by FirstByte

What is OpenVPN

OpenVPN is known as a completely free and open source VPN software. OpenVPN is also considered the best solution for those who want a secure and reliable connection between two networks. It is an old known protocol.

OpenVPN provides secure point-to-point connections in routed or bridged configurations, as well as remote access facilities. It uses its own security protocol based on SSL/TLS to establish an encrypted connection on the Internet.

How to install OpenVPN

To install OpenVPN we must first connect to our server.
And then execute this command and press Enter.

wget https://git.io/vpn -O openvpn-install.sh && bash openvpn-install.sh

After executing this command, we will see such a screen and we must choose the appropriate parameters for our future OpenVPN server. You can see the optimal settings in the screenshot.

Which protocol should OpenVPN use?
1) UDP (recommended)
2) TCP
Protocol [1]: 1
What port should OpenVPN listen to?
Port [1194]: 1194
Select a DNS server for the clients:
1) Current system resolvers
2) Google
3) 1.1.1.1
4) OpenDNS
5) Quad9
6) AdGuard
DNS server [1]: 3
Enter a name for the first client:
Name [client]: client

Press Enter and wait for OpenVPN to install. Usually this process takes only 1 minute.

After installation, we get a profile that we must download from the server.

How to download the configuration file from the server

We must first install Curl and this can be done with command:

Debian/Ubuntu: apt install curl
CentOS/RHEL: yum install curl

Once Curl is installed, we can upload and download our configuration file with the command:

curl --upload-file /root/client.ovpn https://transfer.sh

Follow the link and download VPN profile

How to connect to OpenVPN server

To connect to a VPN, we must download the VPN software from the official OpenVPN website.
Once installed, OpenVPN will already be open. Now, we must import our profile.
In the notification area, look for the icon of our OpenVPN, press the right mouse button and click on Import, and then on Import file ..

We select our profile which we have already downloaded before and click on Open

Then we right click back on the OpenVPN icon and click on Connect

If you’ve done everything right, you’ll have an OpenVPN window open where it’s trying to connect, and then you’ll get a notification that the connection succeeded, and then the window will close and the empty icon monitor will turn green.

How to connect to OpenVPN using your phone

To connect using your phone to our OpenVPN server, you must first download the app from the Play Store for Android, or from the Apple Store for iOS. After installation, you must download the profile. You can download it from the link where we have already downloaded it to our PC.