TGRank — Telegram channel marketplace
TGRank
Your independent guide to Telegram stats
Каналы
Русскоязычные923Україна133Oʻzbekiston50English221فارسی113World1 416
Язык сайта
27 Users
24 per day
0 Online
Log in with TelegramLog in
Technology & IT

How to set up a VPN server on Ubuntu in 2026: a step-by-step guide for beginners

TGRank editorial team November 23, 2026 8 min read
How to set up a VPN server on Ubuntu in 2026: a step-by-step guide for beginners

Learn how to build your own VPN server on Ubuntu in just a few hours, ensure its reliable protection, and choose the optimal solution between OpenVPN and WireGuard.

Contents
  1. Server Preparation and OpenVPN Installation
  2. Creating the Certificate and Key Infrastructure
  3. Basic OpenVPN Server Setup
  4. Client Setup and Connection Check
  5. WireGuard as a Simple VPN Server Alternative
  6. VPN Server Security Checklist
  7. Summary and practical conclusion

Setting up an Ubuntu VPN server in 2026 is easier than it seems: all it takes is properly preparing the host and generating a set of certificates. You get a secure tunnel for your home network, save money on commercial service subscriptions, and have full control over your traffic.

Below is a step-by-step guide designed for beginners, requiring minimal hardware and avoiding unnecessary complexity.

Server Preparation and OpenVPN Installation

Choosing a VPS/Home Computer

For a home network, any modern processor with 1 GB of RAM and 10 GB of SSD storage will suffice. If you plan to serve multiple devices, it is better to go with 2 GB of RAM and a 20 GB disk. There are VPS options on the market starting from 5 USD/month, which fits the budget of most users.

Updating the System

  1. Connect to the server via SSH.
  2. Update the package list: apt update.
  3. Install the latest versions: apt upgrade -y.

Installing the OpenVPN Package

  1. Install OpenVPN and the easy-rsa utility: apt install -y openvpn easy-rsa.
  2. Create a directory for PKI: make-cadir /etc/openvpn/easy-rsa.
  3. Switch to that directory: cd /etc/openvpn/easy-rsa.

Checking Service Operation

Start the daemon: systemctl start openvpn@server. Then check the status: systemctl status openvpn@server. If you see “active (running)”, the service is ready for further configuration.

Creating the Certificate and Key Infrastructure

PKI Initialization

  1. Initialize PKI: ./easyrsa init-pki.
  2. Generate environment variables (optional): ./easyrsa build-ca nopass.

Generating a CA Certificate

The Certificate Authority (CA) root certificate signs all other keys, so it must be stored in a secure place. Command:

./easyrsa build-ca nopass

Enter the organization name – this will be visible in every certificate.

Creating a Server Certificate

  1. Create a request: ./easyrsa gen-req server nopass.
  2. Sign it: ./easyrsa sign-req server server.
  3. Copy the ca.crt, server.crt, and server.key files to /etc/openvpn.

Creating Client Certificates

For a home PC, let's name the client home-pc. Run the following:

  1. ./easyrsa gen-req home-pc nopass
  2. ./easyrsa sign-req client home-pc
  3. Move home-pc.crt and home-pc.key to the client directory (e.g., /etc/openvpn/client).
Do not store private keys on public servers – use a separate secure disk or USB drive.

Currently, TGRank has 105 Telegram channels in the "Technology and IT" category with a total audience of 15 142 006 subscribers and a median engagement of 6.4% (according to TGRank data). If you want to place an ad for your VPN project, see the "Technology and IT" category Telegram channel catalog.

Basic OpenVPN Server Setup

Configuration file server.conf

Create /etc/openvpn/server.conf and include the main parameters. Example:

port 1194 proto udp dev tun ca ca.crt cert server.crt key server.key dh dh.pem cipher AES-256-GCM auth SHA256 persist-key persist-tun keepalive 10 120 verb 3

Port 1194 UDP is the default, but if there's a conflict you can switch to 443 TCP.

Network settings (IP mask, routes)

Define the virtual subnet, e.g. 10.8.0.0 255.255.255.0. Add the following lines:

server 10.8.0.0 255.255.255.0 push "redirect-gateway def1 bypass-dhcp" push "dhcp-option DNS 1.1.1.1" push "dhcp-option DNS 8.8.8.8"

The first push forces the client to route all traffic through the VPN, the second makes it use public DNS servers.

Enabling encryption and authentication

For 2026 we recommend AES-256-GCM – a fast stream cipher with built-in authentication. Specify auth SHA256 for integrity checking. If you need stricter control, add tls-auth ta.key 0 and distribute ta.key only to clients.

Don’t forget user nobody and group nogroup – the process will run without root privileges, reducing the attack surface.

Starting and enabling the service

Check the syntax:

  1. sudo openvpn --config /etc/openvpn/server.conf --test-parse
  2. If there are no errors, enable the service: systemctl enable --now openvpn@server
  3. Check the status: systemctl status openvpn@server

The log is in /var/log/syslog (filter openvpn). If needed, restart with systemctl restart openvpn@server.

Client Setup and Connection Check

Exporting the Client Configuration File

Create an .ovpn file from the server's certificates and parameters:

client dev tun proto udp remote YOUR_SERVER_IP 1194 ca ca.crt cert home-pc.crt key home-pc.key tls-auth ta.key 1 cipher AES-256-GCM auth SHA256 persist-key persist-tun verb 3

Save the file as home-pc.ovpn and transfer it to the device using secure media.

Installing the OpenVPN Client on Linux and Windows

Linux: sudo apt install openvpn, then connect using the command sudo openvpn --config home-pc.ovpn. Windows: download the official client software and import home-pc.ovpn via the "Import" menu. After importing, click "Connect".

Important: Ensure your router allows traffic on UDP port 1194; if blocked, switch to TCP-443 in both files.

Test Connection and Diagnostics

After connecting, check your external IP:

  1. Linux: curl ifconfig.me
  2. Windows: open whatismyip.com

The IP should differ from your home ISP and match the server's public address.

To perform a trace, use traceroute 8.8.8.8 (Linux) or tracert 8.8.8.8 (Windows). If the path goes through 10.8.0.0/24, the tunnel is working.

If the client does not receive an IP address, check that the client-to-client parameter is enabled in server.conf or that DHCP options do not conflict with your local network.

Common issues: port blocking by the ISP, missing ta.key file, or protocol mismatch (udp vs tcp). For a quick test, you can temporarily disable the firewall with the command ufw disable, and then configure the rule ufw allow 1194/udp.

For detailed statistics on Telegram channels in the "Technology and IT" category, where VPN solutions are frequently discussed, see the TGRank catalog (TGRank data as of October 20, 2026).

WireGuard as a Simple VPN Server Alternative

Why consider WireGuard?

WireGuard is written in 4k lines of code, making it much easier to audit and debug than OpenVPN. By using modern cryptographic primitives (Curve25519, ChaCha20), it achieves low latency and high throughput even on older hardware. Furthermore, the configuration is stored in plain text files, which simplifies automation.

Installation and basic configuration

For Ubuntu 22.04+, simply run two commands:

  1. apt update && apt install wireguard
  2. wg genkey | tee /etc/wireguard/server.key | wg pubkey > /etc/wireguard/server.pub

Create the /etc/wireguard/wg0.conf file:

[Interface] Address = 10.200.200.1/24 ListenPort = 51820 PrivateKey = <content of server.key> [Peer] PublicKey = <client public key> AllowedIPs = 10.200.200.2/32

Start the service: systemctl enable --now wg-quick@wg0. On the client, repeat the key generation, specify the same port and IP addresses, and then check the connection with wg.

Comparison table: OpenVPN vs WireGuard

ParameterOpenVPNWireGuard
Code size≈ 200k lines≈ 4k lines
Transmission speedup to 500 Mbps (UDP)up to 1 Gbps, minimal latency
Protocol supportTCP/UDP, SSL/TLSUDP only, proprietary crypto protocol
Setupmany files, scriptssingle config file
CompatibilityWindows, macOS, Linux, Android, iOSLinux, Windows, macOS, Android, iOS (via official clients)
If you need instant speed and easy maintenance, WireGuard often wins in tests conducted by the TGRank community (according to TGRank, 105 Telegram channels in the "Technology and IT" category discuss its advantages).

VPN Server Security Checklist

  • Regular updates. Schedule automatic apt-upgrade at least once a week to receive kernel patches and cryptography library updates.
  • IP access restriction. In your firewall (ufw or nftables), allow the VPN port only from trusted ranges, for example, 203.0.113.0/24.
  • Use strong ciphers. For OpenVPN, choose cipher AES-256-GCM, and for WireGuard, stick with the standard suite (ChaCha20-Poly1305).
  • Certificate audit. Periodically check the expiration dates of client certificates and revoke inactive ones.
  • Log monitoring. Configure rsyslog or journalctl to send events to a centralized SIEM; look for "auth-failure" and "duplicate key".
  • PKI backup. Store private keys and CA in encrypted archives on a separate server; automate backups every 24 hours.
  • Disable unused protocols. If only UDP traffic is being used, remove TCP listeners from the configuration and close ports 443/80 if they are not needed.

By following these seven points, you will minimize the risks of compromise and maintain the stable operation of your home network. For a more detailed comparison of advertising opportunities in Telegram channels, visit the Technology and IT category Telegram channel directory (TGRank data as of October 20, 2026).

Summary and practical conclusion

You have finished setting up a fully functional OpenVPN server on Ubuntu 20.04/22.04. The server generates its own certificates, client files connect without errors, and ping tests show a stable connection of ≈ 30 ms within your home network.

To maintain security, you should regularly update packages (apt update && apt upgrade), rotate client certificates every 90 days, and monitor logs — searching for auth-failure will help detect unauthorized access attempts. Automatic PKI backup into an encrypted archive and its replication to a separate host eliminates the risk of key loss.

If maximum performance and configuration simplicity are important to you, consider switching to WireGuard. It requires less than 10 lines of configuration, uses modern cryptographic primitives, and provides throughput of up to 5 Gbit/s on a typical home router.

Switching to WireGuard makes sense when the load exceeds 200 Mbit/s or when minimal latency is required for gaming and video conferencing.
  • Keep your system and OpenVPN packages up to date.
  • Rotate certificates and store them in encrypted archives.
  • Monitor logs for failed authentication attempts.
  • If higher speeds are required, migrate to WireGuard.
  • To advertise your IT projects, use the statistics from the Technology and IT category Telegram channel directory — according to TGRank, it contains 105 channels with a total audience of 15,142,006 subscribers and a median engagement rate of 6.4%.

Telegram channels on the topic

Picked by the TGRank team: channels with a real audience — to read and to advertise in

Стратегия Успеха ✓
Стратегия Успеха
23,4K subscribers 14,5K post reach ERR 62%

Канал «Стратегия Успеха» предлагает материалы по личностному росту, бизнес‑стратегиям и эффективному планированию. В публикациях – практические советы, кейсы успешных ко…

Ads from4 700 ₽
Типичный Бизнес ✓
Типичный Бизнес
43,7K subscribers 15K post reach ERR 34%

Типичный бизнес — это не стереотип, а набор проверенных практик, которые помогают предпринимателям избегать распространённых ловушек. Канал публикует типовые сценарии ра…

Ads from7 000 ₽
Заметки Бизнесмена ✓
Заметки Бизнесмена
41K subscribers 13,9K post reach ERR 34%

Заметки бизнесмена — это личный дневник опытного руководителя, превращённый в полезный ресурс для коллег. В постах делятся инсайтами из повседневного управления, стратег…

Ads from6 500 ₽
Ресурсы по программированию
Ресурсы по программированию
19,7K subscribers 4,2K post reach ERR 21%

Programming Resources — кладезь проверенных инструментов и обучающих материалов для всех направлений разработки. Каждый пост содержит ссылки, краткое описание и рекоменд…

Бизнес Победителей ✓
Бизнес Победителей
79,4K subscribers 51,1K post reach ERR 64%

Ищете проверенные методики для масштабирования бизнеса? «Бизнес Победителей» собирает лучшие практики лидеров рынка, от стартапов до крупных компаний. В каждом выпуске –…

Ads from14 500 ₽
Нейросети и Блендер
Нейросети и Блендер
12,7K subscribers 1,4K post reach ERR 11%

Нейросети и Блендер – мост между искусственным интеллектом и 3D‑моделированием. Здесь публикуются обзоры генеративных моделей, примеры их применения в Blender для создан…

% Ads in several channels at once — cheaperBundles on TGRank: up to 40% off when you book a package View → All channels in the category «Technology & IT» →

FAQ

How do I install OpenVPN on Ubuntu?
Run apt update, then apt install openvpn easy-rsa; configure PKI, create a server certificate, configure the server.conf file, and then start the service.
What settings are needed for a secure VPN?
Use a modern cipher like AES-256-GCM, enable HMAC-auth, restrict access by IP, regularly update certificates, and apply strict firewall rules.
Can I use WireGuard instead of OpenVPN?
Yes, WireGuard offers simpler configuration and better performance while maintaining a high level of security; it is well-suited for a home network.
How do I add a new user to an already running VPN server?
Generate a new client certificate via easy-rsa, export the .ovpn file, and provide it to the user; restarting the server is not required.
What should I do if the VPN connection keeps dropping?
Check the OpenVPN log (/var/log/openvpn.log), ensure the UDP/1194 port is open, check MTU values, and verify the stability of your internet connection.
Do I need a separate server for a VPN on a home network?
For most tasks, an old PC or an inexpensive VPS is sufficient; the main requirements are constant internet access and the ability to forward ports.
TGRank editorial team