Centos安装和配置KVM

安装

yum install  -y virt-manager* virt-install libvirt* *vnc*
yum install -y kvm virt-* libvirts bridge-utils qemu-img

启动

virt-manager
问题:(virt-manager:10753): Gtk-WARNING **: 08:11:22.554: cannot open display:
解决:链接服务器的时候加上-X就能够了 "ssh -X username@IP Address"

virt-manager 挂载nfs

[root@localhost home]# service rpcbind restart
Redirecting to /bin/systemctl restart rpcbind.service
[root@localhost home]# service rpcbind restart
Redirecting to /bin/systemctl restart rpcbind.service
[root@localhost home]# service nfs restart
Redirecting to /bin/systemctl restart nfs.service
[root@localhost home]# exportfs -r

cat exports

[root@localhost home]# cat /etc/exports
/iso *(rw,sync,no_root_squash)
/image *(rw,sync,no_root_squash)

问题

1.could not open disk image /home/d/shixun/vm/vdisk.img: Permission denied
 修改文件夹权限以后,如果无效须要查看selinux disabled的状态,重启服务器。
 重启服务器以后,更新
 yum update

使用

  • 开机 |关机| 重启
 
 

配置桥接

-- ifcfg-em0 --

TYPE=Ethernet
BOOTPROTO=none
ONBOOT=yes
BRIDGE=br0
DEVICE=em0

-- ifcfg-br0 --

TYPE=Bridge
BOOTPROTO=static
DEVICE=br0
ONBOOT=yes
IPADDR=*.*.*.*
GATEWAY=*.*.*.*
NETMASK=*.*.*.*
DNS2=*.*.*.*

IP冲突

  • 直接有效的解决办法IP-MAC地址绑定