1. 检测CPU支持

1
[root@kvm02 ~]# egrep '^flags.*(vmx|svm)' /proc/cpuinfo

2.安装

1
[root@kvm02 ~]# yum install kvm virt-* libvirt

3. 确认模块

1
[root@kvm02 ~]# lsmod | grep kvm

4.启动libvirtd

1
2
[root@kvm02 ~]# service libvirtd start
[root@kvm02 ~]# chkconfig libvirtd on

4.1 配置

4.1.0 创建br0网桥

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
[root@kvm02 ~]# cd /etc/sysconfig/network-scripts/
[root@kvm02 network-scripts]# cp ifcfg-eth0 ifcfg-br0
[root@kvm02 network-scripts]# vi ifcfg-eth0

DEVICE="eth0"
NM_CONTROLLED="no"
ONBOOT=yes
HWADDR=00:0C:29:7C:5A:A0
TYPE=Ethernet
BOOTPROTO=none
BRIDGE="br0"
NAME="System eth0"
UUID=5fb06bd0-0bb0-7ffb-45f1-d6edd65f3e03

[root@kvm02 network-scripts]# vi ifcfg-br0
DEVICE="br0"
ONBOOT=yes
TYPE=Bridge
BOOTPROTO=none
IPADDR=192.168.100.12
PREFIX=24
GATEWAY=192.168.100.2
DNS1=8.8.8.8

[root@kvm02 network-scripts]# brctl show

4.1.1 QEMU配置

1
2
[root@kvm02 ~]# vi /etc/libvirt/qemu.conf
vnc_listen=0.0.0.0

4.1.2 Libvirt配置

1
2
3
4
5
6
7
8
9
[root@kvm02 ~]# vi /etc/libvirt/libvirtd.conf
listen_tls = 0
listen_tcp = 1
tcp_port = "16059"
auth_tcp = "none"
mdns_adv = 0

[root@kvm02 ~]# vi /etc/sysconfig/libvirtd
LIBVIRTD_ARGS="--listen"

5. 重启libvirtd服务

1
[root@kvm02 ~]# service libvirtd restart