Cloud Computing 9 min read

Master KVM Virtualization on CentOS: A Complete Text‑and‑Image Guide

This article explains what KVM is, lists its advantages and drawbacks, and provides a step‑by‑step tutorial—including repository configuration, required package installation, kernel module verification, libvirtd service setup, network bridge creation, storage pool and volume creation, ISO import, and virtual machine provisioning—complete with command snippets and screenshots, culminating in a fully functional CentOS 7 VM.

MaGe Linux Operations
MaGe Linux Operations
MaGe Linux Operations
Master KVM Virtualization on CentOS: A Complete Text‑and‑Image Guide

Master KVM Virtualization on Linux CentOS (Text + Images)

Preface

KVM turns the Linux kernel into a bare‑metal hypervisor, allowing multiple virtual machines (VMs) with independent operating systems and resources to run on a single physical host, improving hardware utilization, simplifying management, and reducing costs.

KVM Advantages

High Performance

Hardware Support : KVM leverages hardware virtualization extensions to deliver near‑native performance.

Kernel Integration : As a kernel module, KVM benefits from Linux’s performance optimizations and resource management.

Open‑Source & Cost‑Effective

Open Source : KVM is GPL‑licensed, free to use, modify, and distribute.

Community Support : An active open‑source community provides continuous improvements and support, lowering total ownership cost.

Flexibility

Multi‑OS Support : KVM runs various guest OSes, including Linux distributions, Windows, BSD, etc.

Compatibility : Seamlessly integrates with tools like QEMU and libvirt for powerful virtualization management.

Security

Kernel‑Level Security : Utilizes Linux security features (e.g., SELinux, cgroups) for strong isolation.

Resource Isolation : Each VM runs as an independent process, ensuring secure resource control.

Resource Management & Scalability

Dynamic Adjustment : CPU, memory, network, and storage can be adjusted on‑the‑fly.

Scalability : Easily expand the number of VMs and their resources to meet varying workloads.

KVM Disadvantages

Hardware Dependency

Hardware Requirements : Requires CPUs with virtualization extensions (Intel VT‑x or AMD‑V); unsupported hardware cannot run KVM.

Management Complexity

Learning Curve : Although tools like libvirt help, KVM’s configuration can be more complex than some commercial solutions.

Command‑Line Operations : Advanced features often need CLI commands, which may be challenging for newcomers.

Performance Overhead

I/O Overhead : While performance is close to native, I/O‑intensive workloads may experience some overhead.

Resource Contention : In resource‑constrained environments, multiple VMs may compete for CPU, memory, or I/O, degrading performance.

Summary of Pros : Strong isolation and security. Cons : Additional call overhead and lower resource utilization in some scenarios.

Deployment Tutorial

Configure local YUM source

If no packages are available, configure a network source.

CentOS 7 local source configuration

Configure Alibaba Cloud source for CentOS 7

Enable the options

YUM source configuration screenshot
YUM source configuration screenshot

Install required components

yum install -y qemu-kvm qemu-kvm-tools virt-install qemu-img bridge-utils libvirt virt-manager

Check if CPU supports virtualization cat /proc/cpuinfo | grep vmx Verify KVM kernel modules

[root@localhost ~]# lsmod | grep kvm
kvm_amd               64937  0
kvm                  554609  1 kvm_amd
irqbypass             13503  1 kvm

Start and enable libvirtd service

[root@localhost ~]# systemctl start libvirtd
[root@localhost ~]# systemctl enable libvirtd

Edit bridge interface configuration (ifcfg‑br0)

vim /etc/sysconfig/network-scripts/ifcfg-br0
TYPE=Bridge
BOOTPROTO=static
NAME=br0
ONBOOT=yes
PREFIX=24
DEVICE=br0
IPADDR=192.168.180.139
GATEWAY=192.168.180.254
DNS1=202.96.134.133

Edit physical NIC (ifcfg‑ens33) to attach to the bridge

vim /etc/sysconfig/network-scripts/ifcfg-ens33
TYPE=Ethernet
BOOTPROTO=none
NAME=ens33
DEVICE=ens33
ONBOOT=yes
BRIDGE=br0
Network bridge configuration screenshot
Network bridge configuration screenshot

Launch virt-manager (GUI for libvirt)

virt-manager
virt-manager interface screenshot
virt-manager interface screenshot

Create Storage Pool

In virt‑manager, double‑click “QEMU/KVM”, select the “Storage” tab, and create a new pool (e.g., name it “bdqn_iso”, path “/data_kvm/iso”).

Create storage pool screenshot
Create storage pool screenshot

Create Storage Volume

Create storage volume screenshot
Create storage volume screenshot

Import ISO Image

Drag the ISO file into the newly created pool.

Import ISO screenshot
Import ISO screenshot

Create New Virtual Machine

New VM wizard screenshot
New VM wizard screenshot

Select the location of the ISO image.

Select ISO location screenshot
Select ISO location screenshot

Allocate Resources

Adjust CPU, memory, and other resources according to your host’s capacity.

Resource allocation screenshot
Resource allocation screenshot

Proceed with the remaining options and start the installation.

At this point the experiment is complete – a virtual CentOS 7 machine has been successfully created and is ready for installation.

Installation complete screenshot
Installation complete screenshot
Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

VirtualizationKVMCentOSlibvirtVirt-manager
MaGe Linux Operations
Written by

MaGe Linux Operations

Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.