Introduction
Master virtualization with this comprehensive guide to setting up a VirtIO standalone and High Availability (HA) cluster on Rocky Linux 9. Whether you’re new to virtualization or an experienced IT professional, this guide simplifies the process into clear, actionable steps. We’ll cover everything from installing Rocky Linux, configuring VirtIO drivers, and creating virtual machines using the Cockpit web interface. Let’s get started!
Part 1: Setting Up VirtIO Standalone
Preparation
Verify KVM Installation: Check if KVM is installed by running:
If KVM is installed, you’ll see output similar to:
If no output appears, KVM is not installed.
Install KVM and Virtualization Tools: Install KVM and essential packages:
Add additional tools:
Enable KVM in BIOS: Ensure virtualization is enabled in your BIOS.
Load KVM Modules: If needed, manually load KVM modules:
Start and Enable libvirtd Service:
Hardware Compatibility: Ensure your hardware supports virtualization. Check if your CPU supports VT-x (Intel) or AMD-V (AMD) using:
A result greater than 0 indicates support.
Step 1: Preparing Rocky Linux 9
- Download Rocky Linux 9 ISO from the Rocky Linux Official Download Page.
- Create a bootable USB using tools like Rufus (Windows) or
dd
(Linux). - Boot from the USB and select “Virtualization Host” during installation to include virtualization packages.
Step 2: System and Network Configuration
- Log in and configure the network via the Network Manager GUI or
nmcli
. - Update the system:
Step 3: Install Virtualization Packages
Ensure KVM and related tools are installed:
Enable and start libvirtd:
Step 4: Obtain and Configure VirtIO Drivers
- Download WHQL-certified VirtIO drivers from the Fedora VirtIO Driver Download Page.
- Keep these drivers ready for use during the installation of Windows-based VMs to ensure stability and compatibility.
Installing VirtIO Drivers in Windows VMs:
- During the Windows installation, click “Load Driver” when prompted for disk drives.
- Browse to the VirtIO ISO and select the appropriate driver.
- Install network and other drivers once the OS is set up for optimal performance.
Part 2: Configuring a High Availability Cluster
Initial Cluster Setup
Install HA tools on all cluster nodes:
Start and enable the PCS daemon:
Set a password for the hacluster
user:
Authenticate nodes:
Creating and Configuring the Cluster
Initialize the cluster on one node:
Start and enable the cluster:
Configuring Cluster Resources
Add a virtual IP resource:
Cluster Node Fencing: Configure fencing to prevent split-brain scenarios:
Common Troubleshooting Steps
- Cluster Status Check: Run
sudo pcs status
to check cluster health and resource status. - Restart Cluster Service: If a node isn’t responding, restart services:
- Log Analysis: Use
journalctl -u pcsd
orsudo tail -f /var/log/cluster/corosync.log
to identify issues. - Resource Move: Move a resource manually if needed:
Part 3: Creating Your First VM Using Cockpit
Accessing Cockpit
Install Cockpit and the machines extension:
Enable Cockpit:
Access Cockpit at https://<your-server-IP>:9090
and log in.
Creating a New VM
- Navigate to “Virtual Machines” and click “Create New VM”.
- Enter VM details: Name, installation method (ISO), memory, and CPU allocation.
- For storage, select “Add Disk” and choose a VirtIO disk.
- Set the network model to VirtIO.
- Attach the downloaded VirtIO drivers if creating a Windows VM for better performance.
- Complete the installation by following on-screen prompts and installing additional VirtIO drivers in Windows if needed.
Common Issues During VM Creation
- No Bootable Device Found: Ensure the correct ISO is selected and boot order is set.
- Driver Issues in Windows: Ensure VirtIO drivers are loaded during setup.
- Network Connectivity Problems: Check the network bridge configuration and confirm that the VM is using the correct VirtIO network driver.
Part 4: Verifying and Managing the Cluster
Checking Cluster Status
Run:
This shows the health and resources managed by the cluster.
Managing Cluster Resources
To move a resource:
Replace “node2” with your desired node.
Backup and Recovery
To create snapshots of VMs:
Ensure backups are taken regularly to enable quick recovery from failures.
Testing High Availability
Simulate failures to ensure automatic recovery. Perform tests in a non-production environment to validate HA functionality.
Conclusion
This guide has walked you through setting up a VirtIO standalone configuration and an HA cluster on Rocky Linux 9, complete with VirtIO driver integration for enhanced performance. Keep experimenting and refining your setup to meet your specific infrastructure needs. Welcome to the world of efficient virtualization with Rocky Linux 9!