Este contenido no está disponible en el idioma seleccionado.
Chapter 10. Creating a customized RHEL Guest image by using Insights image builder
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
Access Insights image builder in your browser.
You are redirected to the Insights image builder dashboard.
Click Create image.
The Create image wizard opens.
On the Image output page, complete the following steps:
- From the Releases list, select the release of Red Hat Enterprise Linux (RHEL) that you want to use to create the image.
From the Select target environments options, select Virtualization - Guest image.
Click
.
On the Registration page, select the type of registration that you want to use. You can select from these options:
- 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 Creating a customized system image with an embed subscription by using Insights image builder.
- Register image instances only: Register and connect only image instances and subscriptions with Red Hat.
- Register later: Register the system after the image creation.
- Click .
- Optional: On the Packages page, add packages to your image. See Adding packages during image creation by using Insights image builder.
- On the Name image page, enter a name for your image and click . If you do not enter a name, you can find the image you created by its UUID.
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.
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.NoteThe
.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
- Access the directory where you downloaded your QCOW2 image.
Create a file named
meta-data
. Add the following information to this file:instance-id: nocloud local-hostname: vmname
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
.
-
Use the
genisoimage
command to create an ISO image that includes theuser-data
andmeta-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)
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.
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
Additional resources