The below Bash script works with Ubuntu 20.04 LTS, on WSL2, VM, or hardware install.
Microsoft has a full article with all the details. This is a summary for quick reference.
On Windows you need to do this from an elevated (administrator) command prompt or powersehll window. Easiest way is Win+X,A.
wsl --install -d Ubuntu
Once your machine has finished rebooting, installation will continue and you will be asked to enter a username and password. This will be your Linux credential for the Ubuntu distribution.
Start Ubuntu from the start menu, or from the terminal by typing ubuntu
- Short link for this GIST https://embt.co/Ubuntu4Delphi22