Buscar

Este contenido no está disponible en el idioma seleccionado.

Chapter 10. Creating a customized RHEL Guest image by using Insights image builder

download PDF

You can create customized RHEL guest system images by using Insights image builder. You can then download these images to create virtual machines from these guest images according to your requirements.

10.1. Creating a customized RHEL Guest system image by using Insights image builder

Complete the following steps to create customized RHEL Guest .qcow2 images by using Insights image builder.

Procedure

  1. Access Insights image builder in your browser.

    You are redirected to the Insights 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:

  5. Click Next.
  6. Optional: On the Packages page, add packages to your image. See Adding packages during image creation by using Insights image builder.
  7. 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.
  8. 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.

  9. 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.

    Note

    The .qcow2 images are available for 6 hours and expire after that. Ensure that you 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 by using Insights image builder.

Prerequisites

  • You created and downloaded a QCOW2 image by using Insights image builder.

Procedure

  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:

    #cloud-config
    user: admin
    password: password
    chpasswd: {expire: False}
    ssh_pwauth: True
    ssh_authorized_keys:
      - ssh-rsa AAA...fhHQ== your.email@example.com
    • ssh_authorized_keys is your SSH public key. You can find your SSH public key in ~/.ssh/id_rsa.pub.
  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 \
        --virt-type kvm \
        --graphics none \
        --import

    Where,

    • --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 (Ootpa)
    Kernel 4.18.0-221.el8.x86_64 on an x86_64
Red Hat logoGithubRedditYoutubeTwitter

Aprender

Pruebe, compre y venda

Comunidades

Acerca de la documentación de Red Hat

Ayudamos a los usuarios de Red Hat a innovar y alcanzar sus objetivos con nuestros productos y servicios con contenido en el que pueden confiar.

Hacer que el código abierto sea más inclusivo

Red Hat se compromete a reemplazar el lenguaje problemático en nuestro código, documentación y propiedades web. Para más detalles, consulte el Blog de Red Hat.

Acerca de Red Hat

Ofrecemos soluciones reforzadas que facilitan a las empresas trabajar en plataformas y entornos, desde el centro de datos central hasta el perímetro de la red.

© 2024 Red Hat, Inc.