安装wget和vim
yum install -y wget vim
修改yum源为阿里源
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
sed -i ‘s/$releasever/7/g‘ /etc/yum.repos.d/CentOS-Base.repo
安装基本包
yum install epel-release net-tools vim unzip zip wget ftp -y
安装开发环境
yum groupinstall "DevelopmentTools"
安装虚拟环境包
yum groupinstall "Virtualization" "Virtualization Client""Virtualization Platform"
安装桌面(可选)
yum -y groupinstall Desktop
yum -y groupinstall "X Window System"
安装GNOME桌面环境
yum install gnome-classic-session gnome-terminal nautilus-open-terminal control-center liberation-mono-fonts
创建硬盘
[[email protected] images]# qemu-img create -f qcow2 /var/lib/libvirt/images/kvm01.img 20G
安装kvm
[[email protected] images]# virt-install --name=kvm01 --ram 6144 --vcpus=2 --disk path=/var/lib/libvirt/images/kvm01.img,format=qcow2,size=20 --network bridge=br0 --os-type=linux --cdrom /var/lib/libvirt/images/CentOS-7-x86_64-Minimal-1611.iso --vnc --vnclisten=0.0.0.0 --vncport=5910
修改kvm.xml
<graphics type=‘vnc‘ port=‘5900‘ autoport=‘no‘ listen=‘0.0.0.0‘>
<listen type=‘address‘ address=‘0.0.0.0‘/>
</graphics>
创建快照
[[email protected] images]# virsh snapshot-create kvm01
查看快照
[[email protected] images]# virsh snapshot-list kvm01
Name Creation Time State
------------------------------------------------------------
1502871731 2017-08-16 16:22:11 +0800 shutoff
恢复快照
[[email protected] images]# virsh domstate kvm01