1、 环境
CentOS6.2 X86_64 最小化安装
2、 系统环境初始化(个人习惯)
#yum install wget vim-enhanced which screen make setuptool system-config-network* xorg-x11-xauth && yum groupinstall “development tools” && yum update
备注:关闭SeLinux
3、 检查CPU
#egrep 'vmx|svm' /proc/cpuinfo
备注:如果能正常返回结果,就说明支持,VMX代表intel CPU,SVM代表AMD CPU。
4、 安装KVM
#yum groupinstall Virtualization 'Virtualization Client'
#yum install dejavu-lgc-sans-fonts
备注:不安装这个字体,virt-manager界面会出现“口”乱码。
5、 安装API支持
#yum install avahi dmidecode libvirt
#/etc/init.d/messagebus restart
#/etc/init.d/avahi-daemon restart
#service libvirtd restart
备注:不安装avahi,dmidecode,并成功启动相关服务的话,libvirtd无法启动,详细报错查看tail -f /var/log/libvirt/libvirtd.log
6、网络桥接
#cd /etc/sysconfig/network-scripts/
修改要桥接的物理网卡,如ifcfg-eth0
#vim ifcfg-eth0
增加:
BRIDGE=br0
注释掉IP相关信息:
IPADDR=
NETMASK=
GATEWAY=
DNS1=
新建虚拟的桥接网卡br0
#vim ifcfg-br0
增加如下内容,:
DEVICE=br0
TYPE=Bridge
ONBOOT=yes
BOOTPROTO=static
以下为eth0中注释掉的部分
IPADDR=
NETMASK=
GATEWAY=
DNS1=
保存后重启网络:
#service network restart
7、 验证是否已经载入KVM模块
#lsmod | grep kvm
Kvm
Kvm_intel
8、 使用virt-manager(GUI)或virt-install(CLI)安装guest
在此不再赘述!
9、安装过程中遇到的问题及解决方法
A:service libvirtd restart 启动失败,查看/var/log/libvirt/libvirtd.log
日志显示:
2012-04-18 13:51:03.032+0000: 18149: error : virNetServerMDNSStart:460 : internal error Failed tocreate mDNS client: Daemon not running
解决方法:
#yum install avahi
#/etc/init.d/messagebus restart
#/etc/init.d/avahi-daemon restart
#service libvirtd restart
此时如果仍然启动失败,继续查看/var/log/libvirt/libvirtd.log
日志显示:
2012-04-18 13:54:54.654+0000: 18320: error : virSysinfoRead:465 : internal error Failed to find path for dmidecode binary
解决方法:
#yum install dmidecode
#service libvirtd restart
启动成功
B:virt-manager启动报错
# virt-manager
Xlib: extension "RANDR" missing on display "localhost:10.0".
process 1869: D-Bus library appears to be incorrectly set up; failed to read machine uuid: Failed to open "/var/lib/dbus/machine-id": No such file or directory
See the manual page for dbus-uuidgen to correct this issue.
D-Bus not built with -rdynamic so unable to print a backtrace
Aborted
解决方法:
运行如下命令生成必要的machine-id文件:
#dbus-uuidgen > /var/lib/dbus/machine-id
C:virt-manager界面出现"口口"乱码
解决方法:
#yum install dejavu-lgc-sans-fonts
本文出自 “鼠标爱上键盘” 博客,转载请与作者联系!