Embark on a journey to master virtualization with our exhaustive guide on setting up a VirtIO standalone and High Availability (HA) cluster using Rocky Linux 9. This guide is crafted for a wide range of users, from beginners to seasoned IT professionals, breaking down intricate processes into comprehensive, easy-to-follow steps. We’ll cover everything from the ground up – installing Rocky Linux, configuring VirtIO drivers (including how to obtain them from Oracle Linux), to creating your very first virtual machine using the intuitive Cockpit web interface. Let’s dive in!

Part 1: Setting Up VirtIO Standalone


  1. Check if KVM is installed: You can check if KVM is installed on your system by running the following command in your terminal:
lsmod | grep kvm

If KVM is installed, you should see output similar to this:

kvm_intel             364544  0 
kvm                   1056768  1 kvm_intel 
irqbypass              16384  1 kvm

If you don’t see any output, it means KVM is not installed on your system.

  1. Install KVM: If KVM is not installed, you can install it using the package manager for Rocky Linux. Here is the command:
sudo dnf install qemu-kvm libvirt virt-manager virt-install

You can also install other management tools:

sudo dnf install epel-release -y
sudo dnf -y install bridge-utils virt-top libguestfs-tools bridge-utils virt-viewer
  1. Enable KVM in BIOS: If KVM is installed but still not working, you may need to enable virtualization in your system’s BIOS.
  2. Load KVM modules: If KVM is installed and virtualization is enabled in your BIOS, but you’re still seeing the error, you may need to manually load the KVM modules. You can do this with the following command:
sudo modprobe kvm_intel

Please replace kvm_intel with kvm_amd if you are using an AMD processor.

  1. Restart libvirtd service: If the problem persists, you might need to restart the libvirtd service. Here’s how you can do it:
sudo systemctl start libvirtd
sudo systemctl enable libvirtd

Step 1: Preparing Rocky Linux 9

  1. Download the Rocky Linux 9 ISO file from Rocky Linux Official Download Page.
  2. Use a tool like Rufus (for Windows) or dd command (for Linux) to create a bootable USB drive with the downloaded ISO.
  3. Boot your system from the USB drive and follow the installation wizard. When prompted, choose the “Virtualization Host” environment group. This ensures that all necessary virtualization packages are installed.

Step 2: System and Network Configuration

  1. Once installed, log in to your Rocky Linux system.
  2. Configure your network interface using the Network Manager GUI or via the nmcli command-line tool.
  3. Update your system to the latest packages with the command:sudo dnf update -y

Step 3: Installing Virtualization Packages

  1. Open the Terminal and install KVM, QEMU, libvirt, and virt-manager using:sudo dnf install qemu-kvm libvirt virt-install virt-manager -y
  2. Enable and start the libvirtd service to automatically start at boot: sudo systemctl enable --now libvirtd

Step 4: Obtaining and Configuring VirtIO Drivers from Oracle Linux

  1. To enhance the performance of your virtual machines, especially Windows VMs, you’ll need VirtIO drivers. Oracle provides these drivers free of charge.
  2. Visit the Oracle Linux VirtIO Drivers download page and download the latest drivers suitable for your VMs.
  3. Keep these drivers handy, as you will need to specify them during the installation of Windows-based virtual machines.

Part 2: Configuring High Availability Cluster

Initial Cluster Setup

  1. Install the High Availability tools on all nodes of your cluster with:sudo dnf install pacemaker corosync pcs -y
  2. Start and enable the PCS daemon:sudo systemctl start pcsd.service sudo systemctl enable pcsd.service
  3. Set a password for the hacluster user:Copy codesudo passwd hacluster
  4. Authenticate your cluster nodes from one of the nodes (replace node1, node2 with your actual node names):Copy codesudo pcs cluster auth node1 node2 -u hacluster

Creating and Configuring the Cluster

  1. Initialize the cluster on one of the nodes:sudo pcs cluster setup --name my_cluster node1 node2
  2. Start the cluster services on all nodes:sudo pcs cluster start --all
  3. Enable the cluster services to start on boot:sudo pcs cluster enable --all

Configuring Cluster Resources and Failover

  1. Add a Virtual IP (VIP) as a resource to your cluster for clients to connect to:sudo pcs resource create VirtualIP ocf:heartbeat:IPaddr2 ip= cidr_netmask=24 op monitor interval=30s
  2. (Optional) For more advanced configurations, such as resource groups or constraints, consult the PCS documentation or use the pcs resource commands to customize your setup.

Part 3: Creating Your First VM with Cockpit Web UI

Accessing and Configuring Cockpit

  1. Install Cockpit and the machines extension:sudo dnf install cockpit cockpit-machines -y
  2. Enable and start the Cockpit service:sudo systemctl enable --now cockpit.socket
  3. Access the Cockpit web interface by navigating to https://<your-server-IP>:9090 in your web browser and log in with your system credentials.

Creating a New VM

  1. In the Cockpit interface, go to the “Virtual Machines” section and click “Create New VM”.
  2. Provide the necessary details for your VM, such as Name, Installation method (ISO or Network Install), Memory, and CPU allocation. For a Windows VM, you’ll need to use the ISO method and have your Windows ISO ready.
  3. For the storage setup, select “Add Disk” and ensure you choose a VirtIO disk for better performance. This is crucial for leveraging the VirtIO drivers you’ve obtained from Oracle Linux.
  4. For network, ensure that the network model is set to VirtIO for optimal networking performance.
  5. In the section for additional options or customization, look for an option to load additional drivers (this might be under an “Advanced” section or similar). Here, you will need to attach the VirtIO drivers you downloaded from Oracle Linux. This step is particularly important for Windows VMs, as they do not come with built-in VirtIO drivers.
  6. Proceed with the VM creation and start the VM. Follow the on-screen instructions to complete the installation of the OS. When prompted for disk drivers during the Windows installation, point the installer to the VirtIO drivers you’ve attached.
  7. Once the installation is complete, you may need to install additional VirtIO drivers within the OS for network or other devices. This can typically be done by pointing the Device Manager to the attached VirtIO drivers disk.
  8. Part 4: Verifying and Managing Your Cluster
  9. Checking Cluster Status
  10. To ensure everything is running smoothly, you can check the status of your cluster by running:sudo pcs status
  11. This command provides an overview of your cluster’s health, including which nodes are active and what resources are currently managed by the cluster.
  12. Managing Cluster Resources
  13. You can manage cluster resources (like starting, stopping, or moving them) using various pcs resource commands. For example, to move the VirtualIP resource to another node, you might use:sudo pcs resource move VirtualIP node2
  14. Replace “node2” with the actual name of the node you wish to move the resource to. Use sudo pcs status again to confirm the resource has successfully moved.
  15. Testing High Availability
  16. A key component of an HA cluster is its ability to recover from failures automatically. To test this, you might simulate a failure (such as stopping the cluster service on a node) and observe how the cluster responds. Always ensure you perform such tests in a controlled environment and not in production.
  17. Conclusion:
  18. You’ve now journeyed through the comprehensive setup of a VirtIO standalone and High Availability cluster using Rocky Linux 9, complete with Oracle Linux VirtIO drivers for enhanced VM performance. By meticulously following each step, from initial system setup to launching your first VM through Cockpit, you’re well-equipped to harness the power and efficiency of virtualization in your infrastructure. Remember, the path to mastery involves continual learning and experimentation, so keep exploring the capabilities of your new virtualization setup and adapt it to your evolving needs. Welcome to the efficient, flexible world of virtualization with Rocky Linux 9!