How to Install Hugo on WSL2

How can we install Hugo in the Windows Subsystem for Linux (WSL2)?

We can do this very easily on our Linux distribution using apt.

sudo apt update -y
sudo apt upgrade -y
sudo apt install hugo -y

The -y stands for “assume yes” and forces an automatic yes to all prompts, so that the commands can run non-interactively.

We can then verify the installation by checking the version.

hugo version

We should receive something like this:

Hugo Static Site Generator v0.68.3/extended linux/amd64 BuildDate: 2020-03-25T06:15:45Z