赞
踩
[root@localhost /root]# virsh create demo.xml
error: failed to connect to the hypervisor
error: no valid connection
error: Failed to connect socket to '/var/run/libvirt/libvirt-sock': No such file or directory
1)查看libvirt进程是否启动? ps -le | grep libvirt*
2)如果没有启动:启动libvirt进程 libvirtd -d
3)查是否安装成功 virsh version ,出现版本就ok了
[root@loalhost /root]# virsh create demo.xml
error: Failed to create domain from demo.xml
error: Network not found: no network with matching name 'br0'
[root@localhost /root]# virsh create demo.xml
error: Failed to create domain from demo.xml
error: internal error: process exited while connecting to monitor:
(process:115194): GLib-WARNING **: 02:32:03.330: gmem.c:489: custom memory allocation vtable not supported
[root@localhost /root]# virsh create demo.xml
error: Failed to create domain from demo.xml
error: Network not found: no network with matching name 'br0'
或者报错:
[root@localhost /root]# virsh create demo.xml
setlocale: No such file or directory
error: Failed to create domain from demo.xml
error: internal error: No <source> 'network' attribute specified with <interface type='network'/>
br0配置如下:
[root@localhost /root]#
#cat /etc/sysconfig/network-scripts/ifcfg-br0
DEVICE=br0
TYPE="Bridge"
BOOTPROTO=static
ONBOOT=yes
1)首先:ifconfig看到有br0网卡信息
2)第二:查看br0网卡信息:
cat /etc/sysconfig/network-scripts/ifcfg-br0
3)第三:找xml中定义br0网卡信息的位置:
#这里应该是bridge模式
<interface type="network">
<source bridge="br0"/>
<model type="virtio"/>
</interface>
Use -machine help to list supported machines!
[root@localhost /root] #virsh create anolis.xml
qemu-kvm: -machine pc-i440fx-2.1,accel=kvm,usb=off: Unsupported machine type
Use -machine help to list supported machines!
1)首先:查看本地kvm支持的类型:
/usr/libexec/qemu-kvm -machine help
2)第二:修改xml文件:
<type arch='x86_64' machine='pc'>hvm</type>
#libvirtd --version
libvirtd: initialization failed
1,打开/etc/profile
export LC_ALL=POSIX #加入这一行保存,这里好像要root权限
保存退出
2,然后source /etc/profile
3,sudo /etc/init.d/libvirt-bin restart
完成,用“libvirtd --version”查看,返回:libvirtd (libvirt) 0.9.13
[root@localhost /root]# virsh create demo.xml
error: failed to connect to the hypervisor
error: no valid connection
error: Failed to connect socket to '/var/run/libvirt/libvirt-sock': Connection refused
[root@localhost /root] #libvirtd --daemon
libvirtd: error: Unable to obtain pidfile. Check /var/log/messages or run without --daemon for more info.
1)杀掉libvirtd进程: kill -9 ps -ef|grep ‘libvirtd --daemon’|grep -v grep |awk ‘{print $2}’
2)删除var/run/libvirtd.pid: rm -rf var/run/libvirtd.pid
3) 启动 libvirtd --daemon
–os-variant参数支持的os可以通过如下命令查看: [root@KVM ~]# osinfo-query os
vim /etc/libvirt/qemu.conf
vnc_listen = "0.0.0.0"
<graphics type='vnc' port='5910' autoport='no' listen='0.0.0.0'>
<listen type='address' address='0.0.0.0'/>
</graphics>
--------》或者《--------------------:
<graphics type='vnc' port='5966' sharePolicy='allow-exclusive' >
<listen type='address' address='0.0.0.0'/>
</graphics>
virt-install \
--name=kvm-test \
--memory=1024 \
--vcpus=1 \
--cdrom=/root/CentOS-7-x86_64-Everything-2009.iso \
--disk path=/home/test-01.qcow2,size=30,format=qcow2 \
--network default \
--virt-type=kvm \
--os-variant=centos7.0 \
--graphics vnc,listen=0.0.0.0,port=5901 \
--noautoconsole
修改: /etc/libvirt/qemu.conf
vnc_listen = "0.0.0.0"
使用virt-install进行CentOS 7的安装时报错:
[root@kvm ~]# virt-install --name=test --memory=512,maxmemory=1024 --vcpus=1,maxvcpus=2 --os-type=linux --os-variant=rhel7 --location=/tmp/CentOS-7-x86_64-DVD-1511.iso --disk path=/kvm_data/test.img,size=10 --bridge=br0 --graphics=none --console=pty,target_type=serial --extra-args="console=tty0 console=ttyS0"
ERROR Host does not support any virtualization options
报错原因:主机不支持任何虚拟化选项
解决方法: 安装openssl软件 yum install -y openssl
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。