How to Set Up a RHEL 8 ISO-Based VM in Hyper-V

ยท

7 min read

How to Set Up a RHEL 8 ISO-Based VM in Hyper-V

Setting up Red Hat Enterprise Linux (RHEL) 8 Minimal version on a Hyper-V virtual machine (VM) is a great way to test and deploy Linux-based applications in a virtualized environment. Whether youโ€™re using it for development, testing, or as part of your enterprise infrastructure, Hyper-V provides a robust virtualization platform. This blog will walk you through the steps to set up RHEL 8 on Hyper-V, covering essential configurations like creating a virtual switch, setting the VM as Generation 2 and using secure boot for better security.

๐Ÿ“ Prerequisites

Before you begin the setup process, there are a few requirements:

  1. Windows 10 or 11 with Hyper-V enabled

  2. RHEL 8 ISO Image

    Download the RHEL 8 ISO file from the official Red Hat website or a mirror. Ensure you have a valid Red Hat subscription (you can use a developer subscription for non-production purposes).

  3. System Resources

    A system with at least 2 GB of RAM (4 GB recommended), 20 GB of free disk space, and a CPU that supports virtualization (Intel VT-x or AMD-V).

  4. Virtual Switch

    You'll need to create a virtual switch in Hyper-V to enable network connectivity for the VM.

โš™๏ธ Step 1: Create a Virtual Switch in Hyper-V

The first step is creating a virtual switch that your RHEL 8 VM will use for networking. Hyper-V allows you to configure three types of virtual switches: External, Internal, and Private. To provide Internet access to the VM, weโ€™ll create an External switch.

Creating the Virtual Switch

  1. Open Hyper-V Manager:

    • Press Windows + S and select Hyper-V Manager.

  1. Access Virtual Switch Manager:

    • In the Actions pane on the right, click Virtual Switch Manager.

  1. Create a New External Virtual Switch:

    • Select New Virtual Network Switch, then choose External.

    • Click Create Virtual Switch.

  1. Select the Physical Network Adapter:

    • In the "External Network" section, select the network adapter you want the VM to use (e.g., Ethernet or Wi-Fi adapter).

    • Ensure Allow management operating system to share this network adapter is checked.

  1. Give the Switch a Name:

    • Name the virtual switch (e.g., "RHEL8-Switch") and click OK to create the switch.

๐Ÿ–ฅ๏ธ Step 2: Create the Generation 2 Virtual Machine

Once the virtual switch is set up, it's time to create the VM.

Creating the Virtual Machine

  1. Open Hyper-V Manager:

    • In Hyper-V Manager, click New > Virtual Machine on the right. > Click on Next.

  1. Specify Virtual Machine Name and Location:

    • Enter a name for your VM (e.g., โ€œRHEL8-VMโ€).

    • Specify the location to store the VM files (you can use the default or a custom path).

    • Click Next.

  1. Choose Generation 2:

    • Select Generation 2 for the virtual machine. Generation 2 VMs support UEFI firmware and are required for secure boot management.

    • Click Next.

  1. Assign Memory:

    • Allocate at least 2 GB of RAM (4 GB recommended) for the VM.

    • Click Next.

  1. Configure Network Adapter:

    • Select the virtual switch you created earlier (e.g., "RHEL8-Switch").

    • Click Next.

  1. Configure Virtual Hard Disk:

    • Choose Create a virtual hard disk and set the size (20 GB minimum recommended). In this setup we will allocate 40GB

    • Click Next.

  1. Install OS from ISO:

    • Choose Install an operating system from a bootable CD/DVD-ROM.

    • Select Image file (.iso) and browse to the location of your RHEL 8 ISO.

    • Click Next.

  1. Finish:

    • Review your settings and click Finish to create the VM.

๐Ÿ”’ Step 3: Optional Changes

Since RHEL 8 supports Secure Boot on Generation 2 VMs, we can leave it enabled. However, if you encounter any issues or prefer to disable it, you can do so, but RHEL 8 should work with it enabled by default.

Enabling Secure Boot

  1. Open VM Settings:

    • In Hyper-V Manager, right-click on the VM (e.g., โ€œRHEL8-VMโ€) and select Settings.

  1. Configuring VM to support Secure Boot :

    • Under Security, In Template select > Microsoft UEFI Certificate Authority

    • Click OK to save the changes.

Allocating cores to the Virtual Machines

  1. Open VM Settings:

    • In Hyper-V Manager, right-click on the VM (e.g., โ€œRHEL8-VMโ€) and select Settings.

  1. Allocate cores:

    • Under Processor, In No of virtual processor set virtual cores as 2.

    • Click OK to save the changes.

๐Ÿš€ Step 4: Start the VM and Install RHEL 8

With the VM created and Secure Boot enabled, it's time to start the VM and install RHEL 8.

Steps to Install RHEL 8:

  1. Start the VM:

    • In Hyper-V Manager, right-click the VM and select Connect.

  • Click Start to power on the VM.

  1. Boot from the ISO:

    • The VM should boot from the RHEL 8 ISO. If prompted, select Install Red Hat Enterprise Linux 8 from the boot menu.

  1. Follow the Installation Steps:

    • Set the language > English > Set keyboard layout > English(India) > Click Done.

  • Set time and date > Select Asia/Kolkata > Click Done.

  1. Software Selection

    Set Software Selection > Select Minimal Installation > check Standard checkbox > Click Done.

  2. Set Network and Hostname:

    • Ensure that the VM is connected to the network by assigning the VM static IP and DNS for ssh access and set the hostname (e.g., โ€œRHEL8-VMโ€).

      Double Click Network and Hostname > Edit hostname to RHEL8-VM > Click Done.

  • Double Click Network and Hostname > Click on Configure > Click on IPv4 Settings > Select Method Manual > Click on Add > Fill details as mentioned in Snap > Click on Save

  • Toggle Ethernet switch to ON > Click Done

  1. Start Installation:

    • Once all settings are configured, click Begin Installation. The installation will proceed and may take some time to complete.
  2. Create Root Password and User Account:

    • Set the root password and create a user account with administrative privileges.

      Double click Root Password > Set root password > Click on Done

Double click User creation > create a new user named โ€œadminโ€ > Check Make this user administrator and Password required > Click on Done

  1. Reboot the System:

    • After the installation is finished, the system will prompt you to reboot. Remove the installation ISO from the virtual CD/DVD drive and reboot the system.

    • Go to Hyper V portal > Right Click on RHEL8-V > Click Settings > Click SCSI Controller > Click DVD drive > Click Remove > Click OK

  • Now Again go to VM setup screen and reboot VM once its completed.

  1. After reboot you will be login to terminal

  2. Now VM us ready for use Now we can ssh from command prompt

    Search CMD > Run as administrator > ssh <username>@<static_vm_ip>

    If the connection is successful, you will see the RHEL 8 command prompt.

๐Ÿ› ๏ธ Step 5: Test Linux Commands

Now that you're logged in, try running some basic Linux commands to ensure everything is working correctly.

Check System Information

  • View the operating system details:

      cat /etc/os-release
    

  • Verify system uptime:

      uptime
    

Note: To assign static IP address access your router settings > Find DHCP > in this you will find start ip and end ip range you can assign static ip to your virtual machine from this ip range

Conclusion: Setting Up RHEL 8 ISO-Based VM in Hyper-V

Creating a RHEL 8 VM in Hyper-V is a straightforward process that enables a robust virtualized Linux environment for development, testing, or enterprise use. By configuring a virtual switch, setting up a Generation 2 VM, and performing a minimal installation, you can quickly deploy and manage RHEL 8. With the system now running and accessible via SSH, you're ready to explore the capabilities of Linux in a flexible and efficient setup.

ย