Dieser Inhalt ist in der von Ihnen ausgewählten Sprache nicht verfügbar.
Chapter 11. Preparing and deploying a KVM Guest Image by using RHEL image builder
Use RHEL image builder to create a .qcow2 purpose-built that you can deploy on a Kernel-based Virtual Machine (KVM) based hypervisor.
Creating a customized KVM guest image involves the following high-level steps:
-
Create a blueprint for the
.qcow2image. -
Create a
.qcow2image by using RHEL image builder. - Create a virtual machine from the KVM guest image.
11.1. Creating customized KVM guest images by using RHEL image builder Link kopierenLink in die Zwischenablage kopiert!
You can create a customized .qcow2 KVM guest image by using RHEL image builder. The following procedure shows the steps on the GUI, but you can also use the CLI.
Prerequisites
-
You must be in the
rootorweldrgroup to access the system. -
The
cockpit-composerpackage is installed. - On a RHEL system, you have opened the RHEL image builder dashboard of the web console.
- You have created a blueprint. See Creating a blueprint in the web console interface.
Procedure
- Click the blueprint name you created.
- Select the tab Images.
- Click Create Image to create your customized image. The Create Image window opens.
-
From the Type drop-down menu list, select
QEMU Image(.qcow2). - Set the size that you want the image to be when instantiated and click Create.
- A small pop-up on the upper right side of the window informs you that the image creation has been added to the queue. After the image creation process is complete, you can see the Image build complete status.
Verification
-
Click the breadcrumbs icon and select the Download option. RHEL image builder downloads the KVM guest image
.qcow2file at your default download location.
11.2. Creating a virtual machine from a KVM guest image Link kopierenLink in die Zwischenablage kopiert!
With RHEL image builder, you can build a .qcow2 image, and use a KVM guest image to create a VM. The KVM guest images created using RHEL image builder already have cloud-init installed and enabled.
Prerequisites
-
You created a
.qcow2image by using RHEL image builder. See Creating a blueprint in the web console interface. -
You have the
qemu-kvmpackage installed on your system. You can check if the/dev/kvmdevice is available on your system, and virtualization features are enabled in the BIOS. -
You have the
libvirtandvirt-installpackages installed on your system. -
You have the
genisoimageutility, that is provided by thexorrisopackage, installed on your system.
Procedure
-
Move the
.qcow2image that you created by using RHEL image builder to the/var/lib/libvirt/images/directory. Create a directory, for example,
cloudinitisoand navigate to this newly created directory:mkdir cloudinitiso cd cloudinitiso
$ mkdir cloudinitiso $ cd cloudinitisoCopy to Clipboard Copied! Toggle word wrap Toggle overflow Create a file named
meta-data. Add the following information to this file:instance-id: citest local-hostname: vmname
instance-id: citest local-hostname: vmnameCopy to Clipboard Copied! Toggle word wrap Toggle overflow Create a file named
user-data. Add the following information to the file:Copy to Clipboard Copied! Toggle word wrap Toggle overflow ssh_authorized_keysis your SSH public key. You can find your SSH public key in~/.ssh/<id_rsa.pub>\.Use the
genisoimageutility to create an ISO image that includes theuser-dataandmeta-datafiles.Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create a new VM from the KVM Guest Image using the
virt-installcommand. Include the ISO image you created on step 4 as an attachment to the VM image.Copy to Clipboard Copied! Toggle word wrap Toggle overflow - --graphics none - means it is a headless RHEL 8 VM.
- --vcpus 4 - means that it uses 4 virtual CPUs.
- --memory 4096 - means it uses 4096 MB RAM.
The VM installation starts:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
After the boot is complete, the VM shows a text login interface. To log in to the local console of the VM, use user the details from the user-data file:
-
Enter
adminas a username and press . Enter
passwordas password and press .After the login authentication is complete, you have access to the VM using the CLI.