WSL Images
The Windows Subsystem for Linux (WSL) lets developers install and use a Linux distribution on Windows 10 or 11 without the overhead of a traditional virtual machine or dualboot setup.
Although there are several Linux distributions listed in Microsofts default distro list, CentOS Stream is not one of them. Unless Microsofts licensing requirements changes, CentOS Stream will never be on their default list.
But it is not very hard to download and run one of our CentOS Stream WSL images on Windows.
Note
All of these steps are to be done on a Windows 10 or 11 machine, not a Linux machine.
Setup¶
These steps are only needed once.
Install WSL¶
For all the details, here is Microsofts WSL Install Guide.
- Open PowerShell or Windows Command Prompt in administrator mode.
wsl --install
- If WSL is already installed, you will see the WSL help text
Prepare Disk¶
When you run a WSL image, the expanded image needs to be somewhere on the disk. Although it's possible for it to be in the users home area, because we are using the command line, it is often easier to create a short path that holds all your wsl expanded disk images.
For our examples, we created a directory wsl on our e: (data) disk. Thus our path is e:\wsl
Download Image¶
The CentOS Stream 9 WSL images are here. https://mirror.stream.centos.org/SIGs/9-stream/altimages/images/wsl/
For our example, we are going to use the x86_64 version found here: .../wsl/x86_64/CentOS-Stream-Image-WSL-Base.x86_64-9-202410041004.tar.xz
(Optional) Because we are going to use the command line, I move my images into my c:\tmp directory. If you are leaving your downloaded images wherever they are downloaded, replace c:\tmp with whatever your download directory is.
Import Image¶
- Open PowerShell or Windows Command Prompt in administrator mode.
- wsl --import --version=2 ShortName \path\to\storage\ShortName\ .\path\to\the\centos.tar.xz
- ShortName = What WSL will call this image. This can be called anything. For our example I will call it CentOSStream9
- \path\to\storage\ShortName\ = Wherever you have your wsl storage. In our example it is E:\wsl
- .\path\to\the\centos.tar.xz = Wherever you have downloaded your image. In our example it is C:\tmp\CentOS-Stream-Image-WSL-Base.x86_64-9-202410041004.tar.xz
- Example:
wsl --import --version=2 CentOSStream9 E:\wsl\CentOSStream9\ C:\tmp\CentOS-Stream-Image-WSL-Base.x86_64-9-202410041004.tar.xz
Run Image¶
- Open PowerShell or Windows Command Prompt in administrator mode.
- wsl -d ShortName
- Example:
wsl -d CentOSStream9
Note: There is no password for the user. The user has full sudo access. Please be careful with your commands.
Misc Commands¶
If you want to list your local WSL images installed, use the --list option.
wsl --list
The default wsl image is debian. If you want to set it to what we just installed use the --set-default option.
wsl --set-default CentOSStream9
If you want to remove a linux distribution from wsl, use the --unregister option.
wsl --unregister debian
You can directly open your default Linux distribution by going to the Windows Start menu and typing wsl This will open your defaul Linux distribution own console window.