Table of contents
Get the industry’s fastest, most secure VPS hosting ◦ 99.999% uptime
◦ Comprehensive security
◦ 24/7 support

VPS → Install VPN on VPS

How to install a VPN on a VPS

Running a VPN on your VPS is a smart move. It gives you secure, encrypted access to the internet that’s entirely under your control—no third-party logs, no monthly fees, and you can use it across all your devices.

If you’re a Liquid Web customer, good news: your server comes with one free VPN connection, and setup is even easier. Follow this help doc to set up your free Cloud VPN.

But if you’re not using Liquid Web—or if you want to manually set up your own VPN server on a Linux VPS—this guide is for you. We’re walking through the most efficient way to install OpenVPN using a simple shell script. The steps below are for Linux servers (Ubuntu, Debian, CentOS, AlmaLinux, and Rocky Linux all work). If you’re working with a Windows VPS instead, check out this tutorial.

Get premium VPS hosting

High-performance VPS hosting that delivers unrivaled power

1. Connect to your VPS

Before anything else, log in to your VPS using SSH.

Once you’re in, make sure your server’s operating system is up to date:

# Ubuntu/Debian
apt update && apt upgrade -y

# CentOS/AlmaLinux/Rocky
yum update -y

This ensures that dependencies are current and the system is ready for OpenVPN installation.

2. Launch and run the OpenVPN script

OpenVPN is an open-source VPN protocol known for its reliability and strong encryption. It’s widely supported across platforms and is a go-to choice for DIY VPN setups.

The easiest way to install OpenVPN is with a community-maintained script hosted on GitHub by Nyr. This script automates the entire setup and has been used by thousands of VPS owners.

Run the following command to download and execute the script:

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

The script will walk you through several prompts:

Accept the defaults unless you have specific preferences or requirements.

3. Download the configuration file

To use the VPN connection, you’ll need to transfer the .ovpn file (OpenVPN client config) from your VPS to your local device.

Use scp on Unix-based systems:

scp root@your_vps_ip:/root/clientname.ovpn .

Or, if you’re on Windows:

Use WinSCP or another SFTP client:

You’ll use this file with your OpenVPN client app to connect.

4. Connect to your new VPN server

Now that you have the configuration file, just load it into an OpenVPN client. OpenVPN is available for Windows, macOS, Linux, iOS, and Android.

You can repeat the script to add more users or regenerate configuration files anytime.

Additional resources

VPS: A beginner’s guide →

A complete beginner’s guide to virtual private servers

What’s my IP address? →

Find your IP address with one click, using our free online tool

Managed VPS vs unmanaged VPS hosting →

How they compare so you can decide what’s best for you

After studying Mechanical Engineering at Lawrence Technological University, Jeff Goudie earned a Computer Science degree at Eastern Michigan University. He began his career as a mainframe operator, unaware that the tiny IBM XT personal computers he was installing would take off and revolutionize the way we live. Once those little PCs became the way of life, Goudie was hired by Lockheed Martin and contracted at Ford for IT Support. Eventually, he was hired directly at Chrysler to support their lab equipment, computers, and dynamometers, a tech journey that led him to Liquid Web.