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.

  • On RHEL Linux 9, enter:
  • 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

  • If you are on RHEL Linux 8, then enter:
  • 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

  • For other RHEL releases, visit EPEL instructions.
  • 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.
    Setup OpenVPN on RHEL Linux

    In the extracted folder, you will find two separate folders containing the TCP and UDP server files.

    Setup OpenVPN on Red Hat Linux

    Step #4: Now click on the Network icon and open the network settings. Then click on the “+” sign next to the VPN.
    Setup OpenVPN on RHEL Linux

    Step #5: Click on Import from file.
    Setup OpenVPN on RHEL Linux
    Step #6: Navigate to the Downloads folder, and then fastestvpn_ovpn. Then open any of the folders TCP or UDP.

    Setup OpenVPN on RHEL Linux
    Setup OpenVPN on Red Hat
    Step #7: Select your desired VPN server location to which you want to connect, such as “Australia1” and click Open.
    Setup OpenVPN on Red Hat

    Step #8: Enter your FastestVPN username and password and select an option to store the password..
    Setup OpenVPN on RHEL

    Step #9: Click the IPv6 tab and select Disable. Then click on Add.
    Setup OpenVPN on RHEL
    Step #10: Your VPN profile has been created. Turn on its switch to connect to the VPN.
    Setup OpenVPN on Red Hat

    Now it has been connected successfully as shown in the screenshot.

    Setup OpenVPN on Red Hat

    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.
    Setup OpenVPN on Red Hat Linux


    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.
    Setup OpenVPN on RHEL Linux

    In the extracted folder, you will find two separate folders containing the TCP and UDP server files.

    Setup OpenVPN on RHEL Linux


    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)
    Setup OpenVPN on Red Hat Linux

    Step #5: Type ls and press enter.

    It will list the FastestVPN servers.
    Setup OpenVPN on Red Hat Linux
    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

    Setup OpenVPN on RHEL Linux
    Step #7: Now enter your FastestVPN Username and then Password.
    Setup OpenVPN on RHEL Linux
    Step #8: Once the yellow highlighted message appears, that means you are connected.

    Setup OpenVPN on RHEL Linux
    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.