kvm method for installing and removing virtual machines

  • 2020-05-27 07:42:09
  • OfStack

What is KVM;

KVM is a virtual machine based on the Linux kernel (Kernel-based Virtual Machine). In October 2006, a new "virtual machine" implementation was developed by Qumranet in Israel. KVM was included for the first time in the Linux 2.6.20 kernel, released in February 2007. The addition of KVM to Linux kernels is an important milestone in the development of Linux, which is also the first virtualization technology integrated into the Linux mainline kernel.

KVM adds virtualization to the standard Linux kernel, so we can use virtualization with optimized kernels. In the KVM model, each virtual machine is a standard process managed by the Linux scheduler, and you can launch the client operating system in user space.

Install kvm

[root@puppetserver soft]# yum install qemu-kvm libvirt python-virtinst bridge-utils
[root@puppetserver soft]# yum install kvm libvirt python-virtinst qemu-kvm virt-viewer bridge-utils
[root@puppetserver soft]# lsmod | grep kvm
kvm_intel  53484 0 
kvm   316506 1 kvm_intel

[root@puppetserver soft]# /etc/init.d/libvirtd start
Starting libvirtd daemon:     [ OK ]

Remove front:

virsh # list --all
 Id Name    State
 3 test    running
 - test02    shut off
 - test03    shut off

[root@puppetnode01 ~]# cd /etc/libvirt/qemu
[root@puppetnode01 qemu]# ll
total 16
drwxr-xr-x 2 root root 4096 Oct 28 19:36 autostart
drwx------ 3 root root 4096 Oct 28 09:44 networks
-rw------- 1 root root 2965 Oct 28 16:41 test02.xml
-rw------- 1 root root 2961 Oct 28 17:15 test.xml

After the delete:

virsh # destroy test03
error: Failed to destroy domain test03
error: Requested operation is not valid: domain is not running

virsh # undefine test03
Domain test03 has been undefined

virsh # undefine test02
Domain test02 has been undefined

virsh # destroy test
Domain test destroyed

virsh # list --all 
 Id Name    State
 - test    shut off

virsh # undefine test
Domain test has been undefined

virsh # list --all 
 Id Name    State

virsh # 

[root@puppetnode01 qemu]# ll
total 8
drwxr-xr-x 2 root root 4096 Oct 28 19:37 autostart
drwx------ 3 root root 4096 Oct 28 09:44 networks
[root@puppetnode01 qemu]# 


The above is the whole content of this article, I hope the content of this article to your study or work can bring 1 definite help, if you have questions you can leave a message to communicate.

Related articles: