3.2. Deploying a RHEL instance by using a custom base image
To manually configure a virtual machine (VM), first create a base (starter) image. Then, you can modify configuration settings and add the packages the VM requires to operate on the cloud. You can also make additional configuration changes for your specific application after you upload the image.
Creating a VM from a base image has the following advantages:
- Fully customizable
- High flexibility for any use case
- Lightweight - includes only the operating system and the required runtime libraries
To create a custom base image of RHEL from an ISO image, you can use the command line interface (CLI) or the web console for creating and configuring VM.
Verify the following VM configurations.
- SSH - Enable SSH to give remote access to your VM.
- DHCP - Configure the primary virtual adapter to use DHCP.
Prerequisites
- You have enabled virtualization on the host machine.
- For web console, ensure the following options:
- You have not checked the Immediately Start VM option.
- You have already changed the Memory size to your preferred settings.
- You have changed the Model option under Virtual Network Interface Settings to virtio and vCPUs to the capacity settings for the VM.
Procedure
Configure the Red Hat Enterprise Linux (RHEL) VM:
- To install from the command line (CLI), ensure that you set the default memory, network interfaces, and CPUs according to your requirement for the VM. For details, see Creating virtual machines by using the command line
- To install from the web console, see Creating virtual machines by using the web console
When the installation starts:
-
Create a
rootpassword. - Create an administrative user account.
-
Create a
-
After the installation completes, reboot the VM and log in to the
rootaccount. -
After logging in as
root, you can configure the image. Register the VM and enable the RHEL repository:
# subscription-manager registerFor AMD64 or Intel 64 (x86_64) VMs, install the
nvme,xen-netfront, andxen-blkfrontdrivers:# dracut -f --add-drivers "nvme xen-netfront xen-blkfront"For ARM 64 (aarch64) VMs, install the
nvmedriver:# dracut -f --add-drivers "nvme"Including these drivers prevents a
dracuttime-out.Alternatively, you can add the drivers to
/etc/dracut.conf.d/and then enterdracut -fto overwrite the existinginitramfsfile.
Verification
Verify if the system has the
cloud-initpackage and enable it:# dnf install cloud-init # systemctl enable --now cloud-init.service- Power off the VM.