Pular para conteúdo

Import Rocky Linux to WSL

Prerequisites

The Windows-Subsystem for Linux feature has to be enabled. This is possible with one of these options:

This feature should be available on every supported Windows 10 and 11 version right now.

WSL version

Make sure that your WSL version is up to date, as some features only got introduced in a later version, if you are unsure run wsl --update.

Steps

Installable WSL images (preferred)

  1. Download the WSL image from the CDN or another mirror closer to you:

  2. There are multiple options how to install a .wsl image:

    • Double-click the image and it will be installed with the images default name
    • Install the image via command-line:

      wsl --install --from-file <path-to/Rocky-10-WSL-Base.latest.x86_64.wsl> <machine-name>
      

Conventional Container images

  1. Get the container rootfs. This is possible in multiple ways:

  2. (optional) You will have to extract the .tar file from the .tar.xz file if you are using not one of the latest WSL versions

  3. Create the directory where the WSL will store its files (mostly somewhere in the userprofile)
  4. Finally, import the image into WSL (ref.):

    • WSL:

      wsl --import <machine-name> <path-to-vm-dir> <path-to/rocky-10-image.tar.xz> --version 1
      
    • WSL 2:

      wsl --import <machine-name> <path-to-vm-dir> <path-to/rocky-10-image.tar.xz> --version 2
      

WSL vs. WSL 2

Generally speaking WSL 2 should be faster than WSL, but that might differ from use-case to 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, etc.

systemd

The WSL image is systemd enabled out of the box! In case you want to use the container images or build your own one, you will only need to add systemd=true to the boot ini section in the /etc/wsl.conf file! (ref.)

Author: Lukas Magauer