First, installation
#! /bin/bash # #命令运行环境的指定
Virt-install \ # #安装虚拟机
--name \ # #虚拟机名称指定, which represents the first string of characters after the script
--ram \ # #内存
--FILE/VAR/LIB/LIBVIRT/IMAGES/$1.QCOW2 \ # #硬盘文件
--file-size 8 \ # #硬盘文件大小
==cdrom/iso/rhel-server-7.2-x86_64-dvd.iso & # #安装源指定
650) this.width=650; "src=" Https://s1.51cto.com/wyfs02/M01/91/41/wKiom1j0winRmR1mAABPZQqcEyw055.png "title=" Screenshot from 2017-04-17 12-05-04.png "alt=" Wkiom1j0winrmr1maabpzqqceyw055.png "/>
650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M02/91/41/wKiom1j0wkvQFjAGAACH1s_Lll4943.png "title=" Screenshot from 2017-04-17 12-04-16.png "alt=" Wkiom1j0wkvqfjagaach1s_lll4943.png "/>
Second, management
Virt-manager # #开启图形管理工具
Virt-viewer Vmname # #显示虚拟机, Vmname represents the virtual machine name
Virsh List # #列出正在运行的vm
650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M01/91/41/wKiom1j0wheSTNpgAAAyCK_UtiY029.png "title=" Screenshot from 2017-04-17 12-06-04.png "alt=" Wkiom1j0whestnpgaaayck_utiy029.png "/>
Virsh List--all # #列出所有vm
Virsh Start Vmname # #运行指定vm
Virsh Shutdown Vmname # #正常关闭指定vm
650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M00/91/40/wKioL1j0w3byHQJNAAAzHo2YNoo260.png "title=" Screenshot from 2017-04-17 12-06-32.png "alt=" Wkiol1j0w3byhqjnaaazho2ynoo260.png "/>
Virsh Destroy Vmname # #强行结束指定vm
Virsh Create Vmname.xml # #临时恢复指定vm, Vmname represents the front-end management file
Virsh Define Vmname.xml # #永久恢复vm
Virsh undefine vmname # #删除vm前端管理, storage not deleted
650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M01/91/42/wKiom1j0w4uSA0nZAAAyFmBhCIM865.png "title=" Screenshot from 2017-04-17 12-07-47.png "alt=" Wkiom1j0w4usa0nzaaayfmbhcim865.png "/>
Three, virtual machine snapshot
Qemu-img create-f qcow2-b Vmname.qcow2 node1.qcow2
650) this.width=650; "src=" Https://s1.51cto.com/wyfs02/M02/91/40/wKioL1j0w_WyJFpMAADNqBihpZE735.png "title=" Screenshot from 2017-04-17 18-14-11.png "alt=" Wkiol1j0w_wyjfpmaadnqbihpze735.png "/>
To take a snapshot of a virtual machine using a script:
650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M00/91/42/wKiom1j0xE3DrR80AABZZYzf0Rk117.png "title=" Screenshot from 2017-04-17 18-20-48.png "alt=" Wkiom1j0xe3drr80aabzzyzf0rk117.png "/>
Edit '. Sh ' format file gives executable permission
650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M02/91/42/wKiom1j0xILxZL61AAB6LSLRRBQ615.png "title=" Screenshot from 2017-04-17 18-21-02.png "alt=" Wkiom1j0xilxzl61aab6lslrrbq615.png "/>
Meng New Linux Learning Path (14)--System virtual machine management