Fastest way to Install WireGuard-Go on Ubuntu 22.04

I am surprised that there is no documentation about how to install WireGuard-Go from the Ubuntu official repo via APT, and even the installation process is a little bit tricky.


This method only applies to Ubuntu 22.04 (or higher version, maybe), and you should be able to create TUN/TAP devices. For Ubuntu 20.04 or older, the official repo doesn't provide WireGuard-Go.

Note that if you are allowed to load kernel modules, for example, you are not setting up a VPN inside OpenVZ or Docker Containers, you may consider Kernel Space WireGuard instead of User Space WireGuard (e.g., WireGuard-Go introduced in this post).

Step 1. Install Dependencies

sudo apt update
sudo apt install wireguard-go wireguard-tools

Note: The package wireguard should NOT be installed. If you have installed it, just remove it.

Surprisingly, the binary file installed by apt is named wireguard instead of wireguard-go, which is not recognized by wg-quick. So the workaround here is just simply creating a soft link to wireguard file.

cd /bin
sudo ln -s wireguard wireguard-go

Step 3. Launch WireGuard-Go

The tutorial about writing the configuration file of wg-quick is omitted here since we can use the same configuration for both Kernel Space and User Space WireGuard, and we can launch WireGuard-Go in the same way as Kernel Space WireGuard using wg-quick.

# Configuration file is written to /etc/wireguard/wg0.conf
sudo wg-quick up wg0

(Optional) Step 4. Run WireGuard-Go on Startup

sudo systemctl enable wg-quick@wg0