Cloud Computing 9 min read

Master Linux KVM: Step‑by‑Step Deployment with Commands & Screenshots

This guide walks you through installing and configuring a KVM virtualization platform on Linux, covering its advantages and drawbacks, setting up local repositories, verifying hardware support, creating storage pools and volumes, importing ISO images, allocating resources, and launching a virtual CentOS 7 machine using virt‑manager.

Raymond Ops
Raymond Ops
Raymond Ops
Master Linux KVM: Step‑by‑Step Deployment with Commands & Screenshots

Overview

KVM (Kernel-based Virtual Machine) turns the Linux kernel into a bare‑metal hypervisor, allowing multiple virtual machines (VMs) to run on a single physical host with isolated resources, improving hardware utilization and simplifying management.

Advantages

High performance

Hardware support : KVM leverages CPU virtualization extensions (Intel VT‑x, AMD‑V) to deliver near‑native performance.

Kernel integration : As a kernel module it benefits from Linux’s optimizations and resource management.

Open‑source and cost‑effective

Open source : Distributed under the GPL, free to use, modify and redistribute.

Community support : Active community provides continuous improvements and reduces total cost of ownership.

Flexibility

Multi‑OS support : Runs various guest OSes such as Linux distributions, Windows, BSD.

Compatibility : Integrates with QEMU, libvirt and other tools for powerful management.

Security

Kernel‑level security : Uses SELinux, cgroups, etc., for strong isolation.

Resource isolation : Each VM runs as an independent process with controlled resources.

Resource management and scalability

Dynamic adjustment : CPU, memory, network and storage can be resized on‑the‑fly.

Scalability : Easy to add more VMs and adjust configurations for different workloads.

Disadvantages

Hardware dependency

Hardware requirements : Requires CPUs with virtualization extensions; cannot run on older hardware.

Management complexity

Learning curve : Tools like libvirt help, but configuration is more complex than some commercial solutions.

Command‑line operations : Advanced features often need CLI commands.

Performance overhead

I/O overhead : Near‑native speed but I/O‑intensive workloads may see some penalty.

Resource contention : Multiple VMs competing for resources can degrade performance.

Deployment tutorial

Configure a local YUM repository (or use the Alibaba Cloud mirror) to ensure required packages are available.

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

Check CPU virtualization support: cat /proc/cpuinfo | grep vmx Verify that the KVM kernel modules are loaded: lsmod | grep kvm Start and enable the libvirtd service:

systemctl start libvirtd
systemctl enable libvirtd

Edit the bridge interface configuration ( /etc/sysconfig/network-scripts/ifcfg-br0) with content similar to:

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
Bridge configuration screenshot
Bridge configuration screenshot

Edit the physical NIC ( /etc/sysconfig/network-scripts/ifcfg-ens33) to attach it to the bridge:

TYPE=Ethernet
BOOTPROTO=none
NAME=ens33
DEVICE=ens33
ONBOOT=yes
BRIDGE=br0
NIC configuration screenshot
NIC configuration screenshot

Launch virt-manager, create a new storage pool (e.g., bdqn_iso) pointing to /data_kvm/iso, then create a storage volume for the VM disk.

Create storage pool screenshot
Create storage pool screenshot

Import the ISO image into the pool, and start a new VM wizard. Choose the imported ISO, allocate CPU and memory according to host capacity, and finish the installation of CentOS 7.

Virt‑manager new VM wizard
Virt‑manager new VM wizard

After the installation completes, a virtual CentOS 7 machine is ready for use.

Virtual machine running
Virtual machine running
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.

LinuxSysadminKVMCentOSVirt-manager
Raymond Ops
Written by

Raymond Ops

Linux ops automation, cloud-native, Kubernetes, SRE, DevOps, Python, Golang and related tech discussions.

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.