KVM虛拟化平台
簡介
KVM是KernelVirtual Machine的簡寫,目前Linux發行版必須在64位的系統環境才能運作KVM.
同時硬體需要支援VT技術。KVM的前身是QEMU,2008年被Red Hat公司收購并獲得一項hypervisor
技術,不過Red Hat的KVM被認為将成為未來Linux hypervisor的主流。準确來說,KVM僅僅是Linux
核心的一個子產品。管理和建立完整的KVM虛拟機,需要更多的輔助工具。本章将介紹部署虛拟化環
境.建立虛拟機執行個體,以及虛拟機的基本管理。
1、安裝KVM所需軟體
[[email protected] ~]# yum -y install qemu-kvm-tools virt-install virt-manager libvirt

2、關機修改虛拟機配置
3、改為圖形化界面登入
[[email protected] ~]# init 5
4、移動CD光牒,建立虛拟機
建立後完成即可
5、KVM的管理使用
1、檢視
[[email protected] ~]# virsh list --all
2、關機
[[email protected] ~]# virsh shutdown centos7.0
強制關機 [[email protected] ~]# virsh destory centos7.0
3、加載配置檔案
[[email protected] ~]# virsh create /etc/libvirt/qemu/centos7.0.xml
4、挂起和恢複虛拟機 設定虛拟機随主控端一起啟動
[[email protected] ~]# virsh suspend centos7.0
[[email protected] ~]# virsh resume centos7.0
[[email protected] ~]# virsh autostart centos7.0
5、備份虛拟機和删除虛拟機
[[email protected] ~]# virsh dumpxml centos7.0 > ./centos7.0.xml
[[email protected] ~]# virsh undefine centos7.0
[[email protected] ~]# mv ./centos7.0.xml /etc/libvirt/qemu/
[[email protected] ~]# virsh define /etc/libvirt/qemu/centos7.0.xml
6、克隆虛拟機和建立快照
[[email protected] ~]# virt-clone -o centos7.0 -n centos7.01 -f /var/lib/libvirt/images/centos7.01.qcow2
[[email protected] ~]# virsh snapshot-create centos7.0
[[email protected] ~]# virsh snapshot-list centos7.0
[[email protected] ~]# virsh snapshot-revert centos7.0 1604742497
删除快照
[[email protected] ~]# virsh snapshot-delete centos7.0 1604742497