Chapter 10. Creating a customized RHEL Guest image using Red Hat Image Builder

You can create customized RHEL guest system images using Red Hat Image Builder. You can then download these images to create virtual machines from these guest images as per your requirements.

10.1. Creating a customized RHEL Guest system image using Image Builder

Follow the steps to create customized RHEL guest .qcow2 images using Red Hat Image Builder.


  1. Access Red Hat Image Builder on the browser.

    You are redirected to the Red Hat Image Builder dashboard.

  2. Click Create image.

    The Create image wizard opens.

  3. On the Image output page, complete the following steps:

    1. From the Releases list, select the release of Red Hat Enterprise Linux (RHEL) that you want to use to create the image.
    2. From the Select target environments options, select Virtualization - Guest image.

      Click Next.

  4. On the Registration page, select the type of registration that you want to use. You can select from these options:

    1. Register images with Red Hat - Register and connect image instances, subscriptions and insights with Red Hat. For details on how to embed an activation key and register systems on first boot, see Chapter 3, Creating a customized system image with an embed subscription using Red Hat Image Builder.
    2. Register image instances only - Register and connect only image instances and subscriptions with Red Hat.
    3. Register later - Register the system after the image creation.

      Click Next.

  5. Optional: On the Packages page, add packages to your image. See Chapter 4, Adding packages during image creation by Using Red Hat Image Builder.
  6. On the Name image page, enter a name for your image and click Next. If you do not enter a name, you can find the image you created by its UUID.
  7. On the Review page, review the details about the image creation and click Create image.

    After you complete the steps in the Create image wizard, the Image Builder dashboard is displayed.

  8. When the new image displays a Ready status in the Status column, click Download .qcow2 image in the Instance column.

    The .qcow2 image is saved to your system and is ready for deployment.


    The .qcow2 images are available for 6 hours and expire after that. Ensure to download the image to avoid losing it.

10.2. Creating a Virtual Machine from the customized RHEL Guest system image

You can create a Virtual Machine (VM) from the qcow2 image that you created using Red Hat Image Builder.


  • You created and downloaded a .qcow2 image using Image Builder.


  1. Access the directory where you downloaded your .qcow2 image.
  2. Create a file named meta-data. Add the following information to this file:

    instance-id: nocloud
    local-hostname: vmname
  3. Create a file named user-data. Add the following information to the file:

    user: admin
    password: password
    chpasswd: {expire: False}
    ssh_pwauth: True
      - ssh-rsa AAA...fhHQ==
    • ssh_authorized_keys is your SSH public key. You can find your SSH public key in ~/.ssh/
  4. Use the genisoimage command to create an ISO image that includes the user-data and meta-data files.

    # genisoimage -output cloud-init.iso -volid cidata -joliet -rock user-data meta-data
    I: -input-charset not specified, using utf-8 (detected in locale settings)
    Total translation table size: 0
    Total rockridge attributes bytes: 331
    Total directory bytes: 0
    Path table size(bytes): 10
    Max brk space used 0
    183 extents written (0 MB)
  5. Create a new VM from the KVM Guest Image using the virt-install command. Include the ISO image you created on step 4 as an attachment to the VM image.

    # virt-install \
        --memory 4096 \
        --vcpus 4 \
        --name myvm \
        --disk composer-api.qcow2,device=disk,bus=virtio,format=qcow2 \
        --disk cloud-init.iso,device=cdrom \
        --os-variant rhel8.5 \
        --virt-type kvm \
        --graphics none \


    • --graphics none - indicates that it is a headless RHEL Virtual Machine.
    • --vcpus 4 - indicates that it uses 4 virtual CPUs.
    • --memory 4096 - indicates that it uses 4096 MB RAM.
  6. The VM installation starts:

    Starting install...
    Connected to domain myvm
    [  OK  ] Started Execute cloud user/final scripts.
    [  OK  ] Reached target Cloud-init target.
    Red Hat Enterprise Linux 8.5 (Ootpa)
    Kernel 4.18.0-221.el8.x86_64 on an x86_64