To install WireGuard on Ubuntu 26.04, run the VPN on this server and connect from an Ubuntu client on another network. Change 104.248.238.191 to this server's public IP.
Step 1 : Update.

Step 2 : Install WireGuard.


Step 3 : Create the server keys.

Step 4 : Unquoted EOF so $(…) expands. 10.8.0.1/24 is this server on the VPN (wg0), not a LAN address. Change eth0 to this server's public NIC. NAT sends client traffic out through this server.

Step 5 : Enable IP forwarding.

Step 6 : Allow UDP 51820. Forward policy must ACCEPT or NAT drops packets.

Step 7 : Enable and start.

Step 8 : Check the interface.

Step 9 : On the client (Ubuntu). Install WireGuard.


Step 10 : Keys on the client (do not create the private key on the server).

Step 11 : Show the client public key. Paste it in step 12.

Step 12 : On the server — [Peer]. Paste the client public key. AllowedIPs = 10.8.0.2/32 is that client's VPN address.

Step 13 : On the client. Paste the server public.key. 10.8.0.2/24 is this client on the VPN (same 10.8.0.0/24 as the server). Change 104.248.238.191 to this server's public IP. AllowedIPs = 0.0.0.0/0 sends icanhazip through the tunnel.

Step 14 : On the client. Bring the tunnel up, ping the server VPN address, then curl -4 for this server's public IPv4.

This article uses Ubuntu as the client. You can use the WireGuard app on Windows or macOS with the same [Interface] / [Peer] tunnel file.
To add another client, generate a new key pair, pick a free VPN address (for example 10.8.0.3/24), add a [Peer] block on the server with that public key and AllowedIPs = 10.8.0.3/32, then restart wg-quick@wg0.
You have installed WireGuard on Ubuntu 26.04.