Installation of virtual machines
Command mode
Virt-install \
--name \
--ram 1000 \
--FILE/VAR/LIB/LIBVIRT/IMAGES/$1.IMG \
--file-size 8 \
--cdrom/var/ftp/pub/iso/rhel-server-7.1-x86_64-dvd.iso
Script mode
Vim westos.sh
#!/bin/bash Environmental Development
Virt-install \ Installing virtual machines
--name \ Name
--ram 1000 \ Memory
--FILE/VAR/LIB/LIBVIRT/IMAGES/$1.IMG \ Hard Disk File
--file-size 8 \ Hard disk size
--cdrom/var/ftp/pub/iso/rhel-server-7.1-x86_64-dvd.iso developing the installation source
Managing Virtual Machines
Virt-manager Opening the Graphics management tool
Virt-viewer vmname Display virtual machines
Vrish List List of running virtual machines
Vrish list-all List all virtual machines
Vrish start Vmname Run the development VM
Virsh shutdown vmname normal shutdown VM
Virsh destroy Vmname forcibly end VM
Virsh Create vmname.xml temporarily restore VM
Virsh define Vmname.xml permanently recover VMS
Virsh undedine Vmname Deleting the front end of a VM does not delete storage
Setting up a Snapshot
Qemu-img create-f qcow2-b/var/lib/libvirt/images/vm1.qcow2/var/lib/libvirt/images/hello.qcow2
Resetting a snapshot with a script
Vim filename.sh
#!/bin/bash
echo Poweroff Hello
Virsh Destroy Hello &>/dev/null/close Snapshot
Echo del hello.xml ...
Virsh undefine Hello &>/dev/null/delete Snapshot
Echo Create Disk ...
Qemu-img create-f qcow2-b/var/lib/libvirt/images/vm1.qcow2/var/lib/libvirt/images/hello.qcow2/ Create a Snapshot
echo Create Hello vm ...
Virt-install \/Install virtual machine
--name Hello \/OK name
--ram 2000 \/Determine memory size
--DISK/VAR/LIB/LIBVIRT/IMAGES/HELLO.QCOW2 \/Specify hard drive location
--import &>/dev/null &/Start graphical interface
Linux Learning Note 7