BIOS开启VT
安装ubuntu系统
安装kvm相关的软件,并设置桥接网卡
(1) # apt-get install qemu-kvm libvirt-bin virtinst bridge-utils cpu-checker
#$ sudo apt-get install virt-managerqemu
(2) #kvm-ok
INFO: /dev/kvm exists
KVM acceleration can be used(3) #cp /etc/network/interfaces /etc/network/interfaces.bakup
(4) #vi /etc/network/interfaces
auto br0
iface br0 inet static
address 10.18.44.26
netmask 255.255.255.192
broadcast 10.18.44.63
dns-nameservers 10.0.80.11 10.0.80.1
bridge_ports eth0
bridge_stp off
bridge_fd 0
bridge_maxwait 0auto eth0
iface eth0 inet static
(5) 如果有都个网卡,可以做多个桥接口
auto br1
iface br1 inet static
address 208.43.222.51
netmask 255.255.255.248
broadcast 208.43.222.55
gateway 208.43.222.49
bridge_ports eth1
bridge_stp off
bridge_fd 0
bridge_maxwait 0
auto eth1
iface eth1 inet static
直接使用brctl命令配置
$ sudo brctl addbr br0
$ sudo ip addr show
$ sudo brctl addif br0 eth0
创建虚拟机:
$ sudo virt-install \
--virt-type=kvm \
--name centos7 \
--ram 2048 \
--vcpus=2 \
--os-variant=rhel7 \
--virt-type=kvm \
--hvm \
--cdrom=/var/lib/libvirt/boot/CentOS-7-x86_64-DVD-1511.iso \
--network=bridge=br0,model=virtio \
--network=bridge=br1,model=virtio \
--graphics vnc \
--disk path=/var/lib/libvirt/images/centos7.qcow2,size=40,bus=virtio,format=qcow2
$ sudo virsh dumpxml centos7 | grep vnc
<graphics type='vnc' port='5901' autoport='yes' listen='127.0.0.1'>
$ sudo virsh vncdisplay centos7
参照:该链接https://www.cyberciti.biz/faq/installing-kvm-on-ubuntu-16-04-lts-server/
原文链接:https://www.f2er.com/ubuntu/353257.html