RHEL

Red Hat Insights image builder enables you to create an image suitable for Windows Subsystem Linux (WSL) so that you can run a Linux environment directly on your Windows machine. You can find the required prerequisites by accessing Install WSL: Prerequisites. You can use most of the command-line tools, utilities, and applications. The kernel is supplied by Microsoft, and developed on WSL2-Linux-Kernel.

Note: This feature is only supported for Red Hat Enterprise Linux (RHEL) version 8, and it is available only in the Preview mode. 

Workflow

The workflow can be summarized as follows:

  1.  Using Insights image builder on the Preview mode, create a customized WSL - Windows Subsystem for Linux (.tar.gz) image.
  2. Download the .tar.gz image to your Windows machine.
  3. Import the .tar.gz container image to the Windows machine. The image you will build does not have a kernel system. It is a container that contains systemd.
  4. After you import the image to WSL and start the container, the image will run as a virtual machine (VM) because it contains a full kernel with full access to hardware. 

WSL acts as a hybrid VM, whose content is supplied by Red Hat, but the kernel is supplied by Microsoft Windows. 

To create an image suitable for Windows Subsystem Linux, ensure that you have met the following prerequisites and then follow the procedure.

Prerequisites

  • You have a running Windows 10 version 2004 and higher or Windows 11 to run the commands in the procedure.

Procedure

  1. Access image builder on the Hybrid Cloud Console (Figure 1).
    Enable the Preview mode and select the Red Hat Enterprise Linux (RHEL) 8 release to be able to select the WSL - Windows Subsystem for Linux target environment.
    Figure 1: Image Builder dashboard.
    Creator Red Hat Console License under Apache 2.0. https://console.redhat.com/
  2. On the upper right menu, enable the Preview mode.
  3. Click Red Hat Insights > RHEL > Inventory > Images. The Insights image builder dashboard will appear.
  4. Click Create image to open the Create image dialog wizard.
  5. On the Image output page, select the following:
    • From the Release list, select Red Hat Enterprise Linux (RHEL) 8.
    • From the Select target environments option, select WSL - Windows Subsystem for Linux (.tar.gz).
    • Click Next.
  6. On the Register page, select Automatically register and enable advanced capabilities. 
  7. On the File system configuration page, select Recommended: Use automatic partitioning.
  8. Click Next.
  9. Optional: On the Content page, complete the following steps to add additional packages to your image:
    • On the Additional Red Hat packages step:
      • On the Available packages search field, enter the package name and click the button.
      • Click the >> button to add all packages shown in the package search results to the Chosen packages dual list box. Optionally, you can click the > button to add only one selected package at a time.
    • On the Custom repositories page, select from the linked custom repositories. Click Next.
    • On the Additional custom packages, search for the available packages and add them. Click Next.
  10. Optional: On the Name image page, enter a name for the image. Each image has a Universally Unique Identifier (UUID). Click Next.
  11. On the Review page, verify the image details about the image creation and click Create image.
    The system verifies the build manifest of the image. After it reaches 100%, the image is added to the build queue. Insights image builder starts to compose a RHEL image for the x86_64 architecture, in the .tar.gz format. After the image is ready, you can see it in the image builder dashboard.
  12. On the Instance column, click Download (tar.gz) to save the image to your Windows system host.

On the Insights Images dashboard, from the Instance column, click "Download (tar.gz)".
Figure 2: Image Builder dashboard with the Download link.
Creator Red Hat Console License under Apache 2.0. https://console.redhat.com/

Install and run the Linux distribution in WSL

  1. On your Windows machine, open the terminal command-line prompt.

  2. To show the Windows subsystem for Linux distributions currently installed on your Windows machine, enter:

    $ wsl -l
    C:\Users\username>wsl -1
    Windows Subsystem for Linux Distributions:
    r8fs
    r8def
    r8sub
    r8subpre
    
    C:\Users\<username>
  3. To list the official images, enter the following command. You can see a list of valid distributions that can be installed.

    $ wsl -l -o
    
    NAME                                 FRIENDLY NAME
    Ubuntu                                Ubuntu  
    Debian                                Debian GNU/Linux
    Kali-linux                            Kali Linux  Rolling
    Ubuntu-18.04                          Ubuntu 18.04 LTS
    Ubuntu-20.04                          Ubuntu 20.04 LTS
    Ubuntu-22.04                          Ubuntu 22.04 LTS
    OracleLinux_7_9                       Oracle Linux 7.9
    OracleLinux_8_7                       Oracle Linux 8.7
    OracleLinux_9_1                       Oracle Linux 9.1
    openSUSE-Leap-15.5                    openSUSE Leap-15.5
    SUSE-Linux-Enterprise-Server-15-SP4   SUSE Linux Enterprise Server 15 SP4
    SUSE-Linux-Enterprise-Server-15-SP5   SUSE Linux Enterprise Server 15 SP5
    openSUSE-Tumbleweed                   openSUSE Tumbleweed
          
  4. Import the Linux distribution that you created to WSL by using the following command:

    $ wsl -–import <DistributionName> <InstallLocation> <FileName>

    For example:

    $ wsl --import rhel8wsl D:\WLS\rhel8wsl \Download\imagebuilder\composer-api-sub-disk.tar.gz
    • rhel8wsl is the name of the distribution.

    • D:\WLS\rhel8wsl is the location where the filesystem will be located.  

    • Download\imagebuilder\composer-api-sub-disk.tar.gz is the .

    After the command finishes running, it imports the image. Once importing the image completes successfully, run the command to check the distributions available for you.

  5. Run the following command to show the Windows subsystem for Linux distributions currently installed on your Windows machine again. You will be prompted with your imported image listed between the existing images:

    $ wsl -l
  6. Launch the image, specifying the distribution name:

    $ wsl -d <name of the distro>

    The name of the distro in this case is rhel8.

Verification

After the image launches in the VM, you can perform the following verification.

To set up a password for root, enter:

# passwd

You will be prompted to type a new password and retype the same password for confirmation.

  1. Check the system subscriptions:

    # systemctl status osbuild-first-boot.service
  2. Check the subscription manager status:

    # subscription-manager status
  3. You can install packages, for example:

    # dnf install -y cockpit

Additional resources

 

Important: This document is provided as a Service Preview and only includes or highlights features that are new as part of the public Service Preview. It is under development and is subject to substantial change. Consider the included information incomplete and use it with caution, as a Service Preview feature is not intended for production use at this point. For more information on Service Previews, see Red Hat Hybrid Cloud Console Life Cycle.

Last updated: February 13, 2024