1,egrep '(vmx|svm)' --color=always /proc/cpuinfo
##如果有返回则表示支持虚拟化
2,yum groupinstall -y 'X Window System' ; yum install -y kvm kmod-kvm SDL-devel
3, wget
wget
rpm -ivh qemu-img-0.14.1-2.el5.rfx.x86_64.rpm
rpm -ivh qemu-0.14.1-2.el5.rfx.x86_64.rpm
lsmod |grep kvm ##有返回则表示已经装入内核,如果没有返回的话,尝试重启服务器,重新载入内核
4,yum install -y virt-viewer virt-manager bridge-utils tunctl
service libvirtd restart
5,打开ssh X11转发
grep 'X11Forwarding yes' /etc/ssh/sshd_config
X11Forwarding yes
6,管理虚拟机
cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
HWADDR=00:E0:81:C1:8D:92
ONBOOT=yes
BRIDGE=br0
cat /etc/sysconfig/network-scripts/ifcfg-br0
DEVICE=br0
BOOTPROTO=static
ONBOOT=yes
TYPE=Bridge
IPADDR=192.168.188.5
NETMASK=255.255.255.0
GATEWAY=192.168.188.1
service network restart
###因为要桥接所以把nat网卡去掉
ifconfig virbr0 down
brctl delbr virbr0
挂起
virsh suspend centos5.5
virt-install --name=centos5.5 --ram=2048 --vcpus=4 --os-type=linux -v --accelerate --cdrom=/data/soft/CentOS-5.5-x86_64-bin-DVD-1of2.iso --file=/data/xuniji/centos5.5 --file-size=40 --bridge=br0
##克隆
virsh suspend centos5.5 ##先挂起虚拟机
virt-clone --connect=qemu:///system --original=centos5.5 --name=centos5.5 --file=/data/xuniji/puppetserver.img -d
恢复挂起
virsh resume centos5.5
阅读(2045) | 评论(0) | 转发(0) |