How to Install WireGuard VPN on Linux (with User Creation & QR Code Setup)

WireGuard is a modern, secure, and fast VPN protocol that’s perfect for Linux servers. This guide will walk you through a quick and easy setup using a well-known installer script — and show you how to create users and scan QR codes for mobile configuration.

Requirements

Supported distributions:

  • AlmaLinux >= 8

✅ Step 1: Install WireGuard Using a One-Line Script

The easiest way to get started is by using the official WireGuard installer from Angristan:

bash
 
curl -O https://raw.githubusercontent.com/angristan/wireguard-install/master/wireguard-install.sh
chmod
+x wireguard-install.sh
./wireguard-install.sh

Once you run the script, it will ask you for:

  • The server’s public IP address

  • VPN port (default: 51820)

  • Interface name (default: wg0)

  • DNS to use for clients

  • Whether to allow IPv4/IPv6 forwarding

After entering the details, it will install WireGuard, enable firewall rules, generate keys, and set up your first client.


 Step 2: Add New Users (Clients)

To create more users later, just re-run the script:

./wireguard-install.sh

Select the option to add a new user, and enter a name when prompted (for example: phone1, laptop, clientA).

Once added, the configuration file will be saved at:

/etc/wireguard/clients/<username>.conf

You can use this file on your laptop or mobile app to connect to your VPN.


 Step 3: Scan QR Code on Mobile

To configure WireGuard on a mobile device (Android/iOS), it’s easiest to use a QR code.

You can now scan this QR code directly using the WireGuard mobile app.


 Bonus Tips

  • All client configurations are stored in:
    /etc/wireguard/clients/

  • To restart the VPN service:

     
    systemctl restart wg-quick@wg0
  • To view VPN status:

     
    wg show

Summary

Using the Angristan WireGuard installer makes deploying a VPN quick, secure, and hassle-free. Whether you’re connecting laptops, mobile devices, or remote employees — WireGuard has you covered.

  • vpn, wire-guard-vpn, setup vpn
  • 0 användare blev hjälpta av detta svar
Hjälpte svaret dig?

Relaterade artiklar

How to Enable Free Duo Security for 2-Step Verification on Windows RDP Server

Enable two-factor authentication (2FA) on your Windows Server using Duo Security for enhanced...