Skip to main content

Installation

OpenVPN can be installed through package managers on most platforms or built from source for custom configurations. Choose the method that best fits your needs.

Debian/Ubuntu

Install from the official repositories:
sudo apt update
sudo apt install openvpn
The OpenVPN community provides updated package repositories at community.openvpn.net/openvpn/wiki/OpenvpnSoftwareRepos

Enable TUN/TAP driver

Load the TUN/TAP kernel module:
sudo modprobe tun
Enable IP forwarding for routing:
echo 1 | sudo tee /proc/sys/net/ipv4/ip_forward
The modprobe command needs to be run once per reboot. Most distributions handle this automatically when using package manager installations.

Red Hat/CentOS/Fedora

Install using yum or dnf:
# RHEL/CentOS 7
sudo yum install epel-release
sudo yum install openvpn

# RHEL/CentOS 8+ and Fedora
sudo dnf install openvpn
See the Fedora package repository for the latest versions.

Arch Linux

sudo pacman -S openvpn

openSUSE

sudo zypper install openvpn

Gentoo

sudo emerge net-vpn/openvpn

Build from source

Building from source gives you the latest features and allows custom configuration options.
1

Download source code

Download the latest release:
wget https://openvpn.net/community-downloads/openvpn-2.6.x.tar.gz
tar -zxf openvpn-2.6.x.tar.gz
cd openvpn-2.6.x
Or clone from the Git repository:
git clone https://github.com/OpenVPN/openvpn
cd openvpn
git checkout release/2.6
2

Install build dependencies

sudo apt install build-essential libssl-dev liblzo2-dev \
  liblz4-dev libpam0g-dev libnl-genl-3-dev libcap-ng-dev
OpenSSL 1.1.0 or higher is required. Alternatively, you can use mbed TLS 2.0 or higher.
3

Configure build options

From a release tarball:
./configure
From Git repository checkout:
autoreconf -i -v -f
./configure
View all configuration options:
./configure --help
Example with custom OpenSSL location:
./configure OPENSSL_CFLAGS="-I/usr/local/include" \
            OPENSSL_LIBS="-L/usr/local/lib -lssl -lcrypto"
4

Compile and install

make
sudo make install
By default, this installs to /usr/local/sbin/openvpn.
5

Verify installation

openvpn --version
Expected output:
OpenVPN 2.6.x x86_64-pc-linux-gnu [SSL (OpenSSL)] [LZO] [LZ4] [EPOLL] [MH/PKTINFO] [AEAD]
library versions: OpenSSL 3.0.x, LZO 2.10
Originally developed by James Yonan
Copyright (C) 2002-2025 OpenVPN Inc <[email protected]>

Test the installation

Verify that OpenVPN is working correctly with these basic tests:
1

Test crypto functionality

Generate a test key and verify crypto operations:
openvpn --genkey secret key
openvpn --test-crypto --secret key
Expected output:
Crypto test passed
2

Test SSL/TLS negotiations (optional)

Run a loopback test using sample configurations (runs for 2 minutes):Terminal 1:
openvpn --config sample/sample-config-files/loopback-server
Terminal 2 (simultaneously):
openvpn --config sample/sample-config-files/loopback-client
This test uses insecure sample certificates and should only be used for testing.

Install Easy-RSA

For managing SSL/TLS certificates, install the Easy-RSA toolkit:
git clone https://github.com/OpenVPN/easy-rsa
cd easy-rsa/easyrsa3
Easy-RSA provides scripts for generating and managing:
  • Certificate Authority (CA)
  • Server certificates and keys
  • Client certificates and keys
  • Diffie-Hellman parameters
Many package managers also provide Easy-RSA as a separate package: apt install easy-rsa or brew install easy-rsa

Next steps

Quick start guide

Set up your first VPN connection

Configuration examples

Explore sample configurations for various scenarios

System requirements reference

Before installation, ensure your system meets these requirements:
ComponentRequirement
TUN/TAP driverUser-space control of virtual point-to-point IP or Ethernet device
Crypto libraryOpenSSL 1.1.0+ or mbed TLS 2.0+
Linux onlylibnl-gen for kernel netlink support
Linux onlylibcap-ng for capability handling
OptionalLZO library for compression
OptionalLZ4 library for compression

Troubleshooting

On Linux, load the module:
sudo modprobe tun
lsmod | grep tun
Verify the device exists:
ls -l /dev/net/tun
OpenVPN requires root privileges to create TUN/TAP devices. Run with sudo:
sudo openvpn --config client.conf
For production, consider dropping privileges after initialization:
user openvpn
group openvpn
Check your OpenSSL version:
openssl version
OpenVPN 2.6 requires OpenSSL 1.1.0 or higher. Upgrade if necessary:
# Debian/Ubuntu
sudo apt install libssl-dev

# RHEL/CentOS/Fedora
sudo dnf install openssl-devel

Build docs developers (and LLMs) love