Before starting this process, my machine was running WSL 1. These are the steps I took to install and to start using WSL 2 side-by-side with WSL 1.

Install Windows 10 build 18917 or higher (via the Windows Insider Program).

Restart the computer.

Enable the Virtual Machine Platform optional component:

dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart

dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart

Restart the computer.

Switch a existing, installed Linux distribution from WSL 1 to WSL 2. (We can later reverse this, if we want to, by running the command with a 1 instead of a 2.)

# list installed distributions
wsl --list 

# set an existing, installed distribution to use WSL 2
wsl --set-version Ubuntu 2

# check that the version switch worked
wsl --list --verbose

Test that it worked by pressing Windows + R and typing Ubuntu. A bash terminal will open. Try navigating to cd / and then typing ls -lA to see the Linux root directory.

If you're using ConEmu, change Startup > Tasks > {Bash::bash} to wsl.exe ~ to make ConEmu's Bash command open to WSL at the user's directory. See also https://github.com/Maximus5/ConEmu/issues/1930

References

https://docs.microsoft.com/en-us/windows/wsl/wsl2-index

Title photo by Charles J Sharp - Own work, from Sharp Photography, sharpphotography, CC BY-SA 4.0, https://commons.wikimedia.org/w/index.php?curid=54619646