See https://github.com/jimmckeeth/Delphi-on-Linux-Setup for updates
This works with WSL2, VM, and hardware installs of CentOS 9 and other Red Hat family distros.
Microsoft has a full article with all the details.
wsl --install
Note: There isn't a Red Hat as part of the default WSL distributions. This script should work with any RPM based distribution using the YUM package manager.
To manually install CentOS Stream 9 follow these steps:
- Download the latest CentOS Stream 9 release
- Extract the content into a folder it can live on your system. I picked
C:\WSL\CentOS9
- Run
CentOS9-stream.exe
as Administrator to install CentOS 9 - Start CentOS 9
CentOS is installed, but it doesn't have a user yet. The following will create a user for you. Then you need to restart the CentOS instance.
- From CentOS
yum update -y && yum install passwd sudo -y
myUsername=jim
adduser -G wheel $myUsername
echo -e "[user]\ndefault=$myUsername" >> /etc/wsl.conf
passwd $myUsername
- From PowerShell
wsl --terminate CentOS9-Stream
- You can now launch CentOS