Import Rocky Linux to WSL or WSL2
Images for other versions
If you are looking for WSL instructions for another version of Rocky Linux, select the version you want from the top menu and then refer to the WSL instructions under "Interoperability."
Prerequisites¶
You must enable the Windows-Subsystem for Linux feature. Do this with one of these options:
- A newer WSL version with extra features is available in the Microsoft Store. Use this newer version whenever possible.
- Open an administrative Terminal (either PowerShell or Command-Prompt) and
run
wsl --install
(ref.) - Go to the graphical Windows Settings and enable the optional feature
Windows-Subsystem for Linux
This feature should be available on every supported version of Windows 10 and 11 currently.
WSL version
Ensure that your WSL version is up to date, as some features were only introduced in later versions. If you are unsure, run wsl --update
.
Steps¶
Conventional Container images¶
-
Get the container rootfs. This is possible in multiple ways:
- Download the image from the CDN:
-
Extract the image from either Docker Hub or Quay.io (ref.)
<podman/docker> export rockylinux:8 > rocky-8-image.tar
-
(optional) You will have to extract the .tar file from the
.tar.xz
file if you are using one of the latest WSL versions - Create the directory where the WSL will store its files (mostly somewhere in the user profile)
-
Finally, import the image into WSL (ref.):
-
WSL:
wsl --import <machine-name> <path-to-vm-dir> <path-to/rocky-8-image.tar.xz> --version 1
-
WSL 2:
wsl --import <machine-name> <path-to-vm-dir> <path-to/rocky-8-image.tar.xz> --version 2
-
WSL vs. WSL 2
Generally speaking, WSL 2 should be faster than WSL, although this may vary depending on the use case.
Windows Terminal
If you have Windows Terminal installed, the new WSL distro name will appear as an option on the pull-down menu, which is quite handy for launching in the future. You can then customize it with colors, fonts, and other elements.
systemd
The WSL image is systemd-enabled by default. If you want to use the container images or build your own, you will only need to add systemd=true
to the boot
section in the /etc/wsl.conf
file. (ref.)
Author: Lukas Magauer