KVM operates as a dynamic loading module in a host, where the KVM module is hardware-agnostic and implements a virtualized core infrastructure; Kvm_intel (or KVM_AMD) is associated with a hardware platform;
[Email protected] ~]# lsmod | grep KVM
Kvm_intel 162153 6
KVM 525259 1 Kvm_intel
[Email protected] ~]#
The KVM client runs as a user-space process (QEMU-KVM), which is dispatched from the kernel to the physical CPU as a normal user process, although it is controlled by the KVM kernel module.
Multiple clients are multiple QEMU-KVM processes for a host, and multiple Vcpus of a client are multiple threads in the QEMU-KVM process.
#创建一个8G的磁盘文件, subsequently used to install the OS
[[email protected] ~]# dd if=/dev/zero of=ubuntu.img bs=1m count=8192
8192+0 Records in
8192+0 Records out
8589934592 bytes (8.6 GB) copied, 26.7009 s, 322 MB/s
[Email protected] ~]#
# Create a VM and specify boot boot from CDROM (Ubuntu ISO) to start the OS installation, and a VNC server port (-vnc:10) is started
# VM Configuration: 1024M memory, 4 CPUs, disk HDA, optical drive CDROM
[Email protected] ~]# /usr/libexec/qemu-kvm-m 1024-smp 4-boot order=cd-hda/root/ubuntu.img-cdrom/root/ubuntu-1 5.10-desktop-amd64.iso-vnc:10 &
[1] 2146
[Email protected] ~]#
The installation of Ubuntu system is completed via VNC client access to 192.168.198.145:10 (where 192.168.198.145 is the host IP).
Issue: Clicking Restart after the OS installation is complete does not appear to be successful; you need to kill the existing process and restart it.
After the installation is complete, ubuntu.img is an image file that has the OS installed, and you can use this image file to start the operating system, and you do not need to specify CDROM.
[Email protected] ~]# /usr/libexec/qemu-kvm-m 1024-smp 4-hda/root/ubuntu.img-vnc:10 &
[1] 2845
[Email protected] ~]#
Switch to the VNC client (TightVNC), enter "Ctrl + Alt + 2" to switch to the QEMU Monitor window and enter the "info KVM" command to see if the current qemu is using KVM.
Enter "Ctrl + Alt + 1" to switch to the normal virtual machine viewing window.
View the QEMU-KVM process on the host, resulting in multiple threads simulating the work of the Vcpus;
QEMU-KVM How to get Started