3.3. 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.
To prepare a cloud image of RHEL, follow the instructions in the sections below. To prepare a Hyper-V cloud image of RHEL, see the Prepare a Red Hat-based virtual machine from Hyper-V Manager.
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.
Settings are enabled either during the initial VM creation or provising VM image to Azure cloud.
- SSH - Enable SSH to give remote access to your VM.
- DHCP - Configure the primary virtual adapter to use DHCP.
-
Swap space - Do not create a dedicated swap file or
swappartition on the operating system (OS) disk or storage disk during installation. Configure thecloud-initutility to automatically create aswappartition on an ephemeral disk of the VM. Ephemeral disk is a local storage of the VM, while resource disk is mounted storage on VM itself. Both storage types store data temporarily. - NIC - Choose virtio for the primary virtual network adapter.
- Encryption - For custom images, use Network Bound Disk Encryption (NBDE) for full disk encryption on Azure.
Prerequisites
- You have checked the required list of system packages.
- 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 register
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.
Next steps
- Install the Azure CLI to access Azure resources and services.