Setup VPN on Red Hat Linux With OpenVPN
This tutorial explains how to set up a VPN on RHEL or Red Hat Linux with the OpenVPN protocol.
Initial Step: It is recommended to update the preinstalled packages on your system by entering yum update on the terminal.
Step One: Install EPEL
First, you need to install the EPEL (Extra Packages for Enterprise Linux) because it contains the OpenVPN package. Open the terminal and enter:
su
It will require your admin password. Enter it and then enter the following command according to your RHEL version.
subscription-manager repos --enable codeready-builder-for-rhel-9-$(arch)-rpms
yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm
subscription-manager repos --enable codeready-builder-for-rhel-8-$(arch)-rpms
yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
After completing this step, follow any of the methods given below to install and set up the OpenVPN on your Red Hat Linux.
Method 1: Setup the VPN on Red Hat Linux through the Network Manager
Step #1: Open the terminal, switch to root by entering su and then install the OpenVPN network manager by entering the following command.
yum install NetworkManager-openvpn NetworkManager-openvpn-gnome
Step #2: Download the FastestVPN OpenVPN server config files from here.
Step #3: Go to your ‘Downloads’ folder and extract the downloaded config files folder.
In the extracted folder, you will find two separate folders containing the TCP and UDP server files.
Step #4: Now click on the Network icon and open the network settings. Then click on the “+” sign next to the VPN.
Step #5: Click on Import from file.
Step #6: Navigate to the Downloads folder, and then fastestvpn_ovpn. Then open any of the folders TCP or UDP.
Step #7: Select your desired VPN server location to which you want to connect, such as “Australia1” and click Open.
Step #8: Enter your FastestVPN username and password and select an option to store the password..
Step #9: Click the IPv6 tab and select Disable. Then click on Add.
Step #10: Your VPN profile has been created. Turn on its switch to connect to the VPN.
Now it has been connected successfully as shown in the screenshot.
When you want to disconnect from the VPN, click on the Network or VPN icon and click Turn Off under the connected VPN connection name.
Method 2: Setup the VPN on Red Hat Linux through the Terminal
Step #1: Open the terminal, switch to root by entering su and then install the OpenVPN by entering the following command.
yum install openvpn
Step #2: Now download the FastestVPN OpenVPN server config files from here.
Step #3: Go to your ‘Downloads’ folder and extract the downloaded config files folder.
In the extracted folder, you will find two separate folders containing the TCP and UDP server files.
Step #4: Now you need to access the folder where your config files were downloaded and unzipped. Enter these commands.
cd Downloads
cd fastestvpn_ovpn
cd tcp_files (OR cd udp_files depending on the protocol you want to connect to)
Step #5: Type ls and press enter.
It will list the FastestVPN servers.
Step #6: In this step, make sure that you are a root user and for this, enter su first.
Now enter openvpn [Your desired server name]
Example: openvpn uk1-tcp.ovpn
Step #7: Now enter your FastestVPN Username and then Password.
Step #8: Once the yellow highlighted message appears, that means you are connected.
To disconnect from the VPN, press Ctrl+C in the same terminal, or in another terminal enter sudo killall openvpn
To connect to another server, repeat Steps 4 to 7.