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
- Step 2: Download the OpenVPN Installer Script
- Step 3: Running the Installer Script
- Step 4: Selecting the Protocol
- Step 5: Configuring the Listening Port
- Step 6: Choosing a DNS Server
- Step 7: Naming the Client
- Step 8: Completing the Installation
- Step 9: Download the Client Configuration
- Step 10: Install the OpenVPN Client for Windows
- Step 11: Import the Configuration File and Connect
- Step 12: Verify Your VPN Connection
- Conclusion
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
Advertisements
we will be using the OpenVPN installer script developed by Nyr. It is available on GitHub at the following link: https://github.com/Nyr/openvpn-install. Download the script to the root directory of your server:
wget https://git.io/vpn -O openvpn-install.sh
Step 3: Running the Installer Script
Run the script:
bash openvpn-install.sh
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.
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.
Step 6: Choosing a DNS Server
Select the DNS (Domain Name System) server that OpenVPN will use. recommend using 1.1.1.1, a popular and privacy-focused DNS server. Enter ‘3’ to choose it.
Step 7: Naming the Client
Enter a name for your OpenVPN client.
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:
Finished!
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 openvpn.net.
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.
Step 12: Verify Your VPN Connection
Advertisements
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.
Conclusion
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.