Detailed Guide to Installing WireGuard VPN on Ubuntu 22.04

Thanh Hien Content has been moderated
Published date:10/5/2026 Update:29/7/2026 Views:168 Reviews: 5.0/580reviews
VPTS on

Detailed guide to installing WireGuard VPN on Ubuntu 22.04 for beginners. Includes server configuration, client creation, mobile connection, and VPN verification.

Guide WireGuard VPNvps

WireGuard is an open-source VPN protocol renowned for high performance, simple configuration, and modern encryption. Compared to many traditional VPN solutions, WireGuard offers high speeds, consumes minimal resources, and is well-suited for deployment on Linux VPS or servers.

In this article,VPTSwill guideinstall WireGuard VPN on Ubuntu 22.04step by step using an automated script, helping you quickly create a VPN Server, configure connected devices, and use it securely for remote access needs or multi-server connections.

1. What Is WireGuard VPN?

WireGuard is an open-source VPN protocol that utilizes state-of-the-art cryptography to create secure private network connections between devices.

In simple terms:

  • Your device will connect to the VPN server
  • All data is encrypted
  • Internet IP will change to the VPS/Server IP
  • Safer connection when using public Wi-Fi

WireGuard stands out thanks to:

  • Ultra-fast speed
  • Low ping
  • Low resource consumption
  • Simple configuration
  • High security
  • Runs stably on both phones and computers

2. Pre-installation requirements

You need to prepare:

  • VPS or server running Ubuntu 22.04.
  • Root access or an account with sudo privileges.
  • One Public IPv4 address.
  • UDP port 51820 allowed through firewall.
  • Windows, Linux, macOS, Android, or iOS client.

If the server is behind a NAT modem or router, you need to forward UDP port 51820 to the server's internal IP address.

3. Guide to installing WireGuard

Step 1: Prepare Ubuntu 22.04 to install WireGuard VPN

Log in to the VPS via SSH and run:

apt update apt upgrade

Step 2: Download and Install WireGuard VPN on Ubuntu 22.04

Run the command below to install WireGuard automatically:

Copy

wget https://git.io/wireguard -O wireguard-install.sh && bash wireguard-install.sh

After running the command, the configuration screen will appear.

  • Select the WireGuard port; you can press Enter to use the default 51820(Or enter another port if desired).
  • Enter the client name (e.g., VPTS, host...) and press enter.
  • Select DNS Server, typically choose: 1.1.1.1 ->enter 3 and press Enter

After completing the configuration, the system displays:

Press any key to continue...

press enter to start installing WireGuard VPN.

install WireGuard VPN on Ubuntu 22.04
  • Select DNS Server, typically choose: 1.1.1.1 ->enter 3 and press Enter

Step 3: Complete installation

After installation is complete, the system will automatically:

  • Create VPN configuration
  • Create your first client
  • Display QR code(to scan directly with a phone)
install WireGuard VPN on Ubuntu 22.04

Step 4: Connect WireGuard on phone

Download application: WireGuard

After downloading:

  • Open the WireGuard app
  • Select the + icon
  • Select Scan QR Code
  • Scan the QR code on the newly installed VPS
  • Click Activate
install WireGuard VPN on Ubuntu 22.04
  • The VPN will connect successfully.

Step 5: Connect WireGuard on client

Next, copy the configuration file

VPTS.conf

downloaded from the VPS to your computer.

install WireGuard VPN on Ubuntu 22.04
  • To use the configured VPN on your computer and phone, download and install WireGuard on your client here:Download WireGuard VPN (4 downloads)
  • After installing WireGuard for the client, open the software and select the file.confdownloaded earlier in order to use the VPN
install WireGuard VPN on Ubuntu 22.04
  • turn on the VPN.
install WireGuard VPN on Ubuntu 22.04

Step 6: Verify VPN operation

After connecting the VPN to the website:https://whatismyipaddress.com

->If the displayed IP is your VPS IP, it means the VPN is working successfully.

install WireGuard VPN on Ubuntu 22.04

Frequently asked questions about WireGuard

Can a configuration file be used across multiple devices?

Technically possible in some cases, but not recommended. Each device should have a separate client and keypair.

Does WireGuard make the network faster?

No guarantee. Speed depends on VPS CPU, bandwidth, network routes, geographic distance, and concurrent connections.

4. CONCLUSION

Through the WireGuard VPN installation guide on Ubuntu 22.04, you have mastered the entire process from preparing the VPS, opening UDP ports, creating clients, and scanning QR codes to checking handshakes and troubleshooting common errors.

WireGuard is a suitable choice for users who need a private VPN Server with a lean configuration, good speed, and flexible management across multiple devices. To keep the system running stably, create separate configurations for each client, protect private keys, inspect firewalls periodically, and delete unused devices promptly.

With a VPS featuring stable bandwidth and a suitable location, you can proactively build a private VPN system for remote work, accessing internal resources, or utilizing the server's IP address.VPTSprovides Vietnam VPS and international VPS suitable for deploying WireGuard, while supporting TUN, firewall, and network connectivity checks during installation.

VPTS – Comprehensive Digital Infrastructure Solutions Provider

VPTS is a digital infrastructure solution provider in Vietnam, serving deployment, operation, and data storage needs for individuals, developers, and enterprises. The service ecosystem includesVietnam VPS, International VPS, VPS Anti DDoS, Hosting cPanel, dedicated server, Rack rental, Proxy IPv4/IPv6, S3 MinIOandCloud Storage.

Besides providing infrastructure resources, VPTS also focuses on assisting customers with deployment, configuration, and practical troubleshooting. Content on the VPTS Blog is drawn from common scenarios in operating VPS, servers, and online systems, helping readers understand root causes and apply clear solutions.

VPTS – Stable infrastructure, flexible solutions, and continuous partnership throughout operations.

VPTS Team Contact Information