egrep ‘(vmx|svm)‘ /proc/cpuinfo
yum -y install qemu-kvm libvirt virt-install bridge-utils
lsmod | grep kvm
systemctl start libvirtd
systemctl enable libvirtd
vim /etc/sysconfig/network-scripts/ifcfg-br0
DEVICE="br0"
ONBOOT="yes"
TYPE="Bridge"
BOOTPROTO=static
IPADDR=172.20.10.11
NETMASK=255.255.255.0
GATEWAY=172.20.10.1
DEFROUTE=yes
vim /etc/sysconfig/network-scripts/ifcfg-bond0
DEVICE=bond0
TYPE=Ethernet
NAME=bond0
BONDING_MASTER=yes
BOOTPROTO=none
BRIDGE=br0
ONBOOT=yes
BONDING_OPTS="mode=5 miimon=100"
systemctl restart network
mkdir -p /var/kvm/images
virt-install --name centos7 --ram 2048 --disk path=/var/kvm/images/centos7.img,size=30 --vcpus 2 --os-type linux --os-variant rhel7 --network bridge=br0 --graphics none --console pty,target_type=serial --location ‘/tmp/CentOS-7-x86_64-Minimal-1611.iso‘ --extra-args ‘console=ttyS0,115200n8 serial‘ --force
a. 查看安装的虚拟机列表:
virsh list --all
b. 启动虚拟机:
virsh start centos7
c. 关闭虚拟机:
virsh shutdown centos7
原文地址:http://blog.51cto.com/12173069/2294364
时间: 2024-11-05 15:23:12