Linux, virtualization kvm

A, kvm virtualization installation

Virtualized system installed in the group must be installed
Here Insert Picture Description

Virtualization Client Client virtualization
Virtualization Hypervisor Virtualization of core components
Virtualization Tools Virtualization tools

Second, the configuration of the network bridge interface kvm

In the configuration directory /etc/sysconfig/network-scripts/Add bridged network
Here Insert Picture DescriptionHere Insert Picture Descriptionconfiguration is complete Network Service Restartsystemctl restart NetworkManager

Three, kvm virtualization-related information

Service Name: libvirtd
virtualized core: qemu / kvm
virtual storage directory: /var/lib/libvirt/images/wang.qcow2
virtualized hardware information: /etc/libvirt/qemu/wang.xml

Fourth, manually install the Virtual Machine

kvm client icon in the following figure
Here Insert Picture Description
can double-click to enter the interface command can also vitr-manageropen the client, prior to installation to ensure kvm libvirtd service enabling
Here Insert Picture Description
installation of a virtual machine There are four ways:
Here Insert Picture Descriptionwith network installation kvm example demonstrates, pay attention when installing memory and hard disk size is not too small or the installation process you have problems
Here Insert Picture DescriptionHere Insert Picture Descriptionstarting the installation
Here Insert Picture Descriptionduring the installation I chose the minimum installation, with no graphical log
Here Insert Picture Description

Fifth, the virtual machine management command

virt-viewer wang Display of the virtual machine named wang
virt-manager Open Virtual Machine Controller
virsh list Lists the virtual machines that are running
virsh list --all List all virtual machines
virsh start wang Open the virtual machine named wang
virsh shutdown wang Normally closed
virsh destroy wang Power outage
virsh define wang.xml Restore virtual machine hardware information
virsh creat wang.xml Open the virtual machine hardware information file

Example 1: virt-viewer wang
Here Insert Picture DescriptionExample 2: virt-manager
Here Insert Picture DescriptionExample 3: virsh list
Here Insert Picture Description
Example 4: virsh list --all
Here Insert Picture DescriptionExample 5: virsh start wang
Here Insert Picture Description
Example 6: virsh shutdown wang
Here Insert Picture DescriptionExample 7: virsh destroy wang
Here Insert Picture Description
Example 8: virsh creat wang.xml
Here Insert Picture DescriptionWhen installed on a host virtual machine wants to run on another host, the need to store the virtual machine directory /var/lib/libvirt/images/wang.qcow2 and hardware information /etc/libvirt/qemu/wang.xml copied. Suppose / mnt u disk mount directory is executed after the two directory copies to

virsh create /etc/libvirt/qemu/wang.xml

The results show that the error
Here Insert Picture Descriptionneeds with / mnt wang.qcow2 files placed in the location specified by the virtual machine again and hardware information file
Here Insert Picture Descriptionnote, only the virtual machine with the create command hardware information file, when the virtual machine is powered off after the client still do not see the virtual machine
Here Insert Picture Descriptionexecution command

virsh define /etc/libvirt/qemu/wang.xml

It is to restore the virtual machine hardware information, after the virtual machine when the machine can also be seen in the client
Here Insert Picture Description

Sixth, the virtual machine snapshot

6.1 virtual machine snapshot command
qemu-img create -f qcow2 -b /var/lib/libvirt/images/wang.qcow2 /var/lib/libvirt/images/node2.qcow2

Here Insert Picture Description

6.2 graphically manner snapshot information into the client

Here Insert Picture DescriptionHere Insert Picture DescriptionHere Insert Picture DescriptionComplete snapshot
Here Insert Picture Description

6.3 with the way the command of the snapshot information into the client

Here Insert Picture DescriptionHere Insert Picture DescriptionHere Insert Picture Description

6.4 complete virtual machine snapshot script way

Here Insert Picture DescriptionHere Insert Picture DescriptionExecute scripts complete snapshot
Here Insert Picture Description

Published 28 original articles · won praise 0 · Views 764

Guess you like

Origin blog.csdn.net/weixin_43834060/article/details/104650378