How to Install OpenVPN on Linux Server

  • Post last modified:October 21, 2023
  • Post category:Linux
  • Post comments:0 Comments
  • Reading time:8 mins read

In this post, i will show you how to install OpenVPN on a Linux server. OpenVPN is a popular VPN solution.

Table of Contents:

Step 1: Update the Server

Log in to your server via SSH and update the server.

sudo apt update
sudo apt upgrade

Step 2: Download the OpenVPN Installer Script


we will be using the OpenVPN installer script developed by Nyr. It is available on GitHub at the following link: Download the script to the root directory of your server:

wget -O

Step 3: Running the Installer Script

Run the script:


Step 4: Selecting the Protocol

Choose a protocol for OpenVPN. UDP (User Datagram Protocol) and TCP (Transmission Control Protocol) are the available options. UDP is recommended for its speed, so select option 1.

selecting protocol for openvpn

Step 5: Configuring the Listening Port

You will be asked to specify the port on which OpenVPN should listen. The default port is 1194, but if you prefer a different port, you can enter it here.

port for openvpn

Step 6: Choosing a DNS Server

Select the DNS (Domain Name System) server that OpenVPN will use. recommend using, a popular and privacy-focused DNS server. Enter ‘3’ to choose it.

selecting DNS server for openvpn

Step 7: Naming the Client

Enter a name for your OpenVPN client.

client name for vpn config

Step 8: Completing the Installation

Press Enter to continue with the installation, and it may take some time to complete. Once finished, you will see the following message:


The client configuration is available in: /root/yourclientname.ovpn
New clients can be added by running this script again.

Step 9: Download the Client Configuration

Download the client configuration file (with a .ovpn extension) to your local machine. You can do this by logging into your server using SFTP, and then go to the location mentioned in the previous step (/root/yourclientname.ovpn). Save the file to local machine.

Step 10: Install the OpenVPN Client for Windows

To connect to the VPN server from a Windows machine, you need to install the OpenVPN client software. You can download the client from the official OpenVPN website at

Step 11: Import the Configuration File and Connect

Open the OpenVPN client, go to “Files,” browse for the .ovpn file, and click “Connect.” The client will start a connection to the VPN server using the provided configuration.

adding config file to openvpn client on windows
after adding the vpn config
connected to the vpn server

Step 12: Verify Your VPN Connection


To check that your VPN connection is working correctly, you can perform a simple test. Open a web browser and search for “What is my IP?” The search results should display the IP address of your Linux server, confirming that your VPN connection is active.

checking ip using google search


Installing OpenVPN on a Linux server is a simple process, thanks to the OpenVPN Road Warrior Installer script developed by Nyr. By following the steps outlined in this guide, you can create a secure VPN and protect your online activities.

Leave a Reply