centos6.x安装KVM

    xiaoxiao2021-11-29  23

    1、系统环境 [root@localhost iso]# cat /etc/redhat-release  CentOS release 6.5 (Final) 2、安装KVM所有需要的包 [root@localhost iso]# yum -y install kvm python-virtinst libvirt tunctl bridge-utils virt-manager qemu-kvm-tools virt-viewer virt-v2v [root@localhost iso]# yum -y install libguestfs-tools [root@localhost iso]# /etc/init.d/libvirtd restart 3、问题 启动的时候报错如下: Starting libvirtd daemon: libvirtd: relocation error: libvirtd: symbol dm_task_get_info_with_deferred_remove, version Base not defined in file libdevmapper.so.1.02 with link time reference [FAILED] 解决办法: yum upgrade device-mapper-libs [root@localhost iso]# /etc/init.d/libvirtd restart [root@localhost iso]#  virsh -c qemu:///system list  Id    名称                         状态 ---------------------------------------------------- [root@localhost iso]# lsmod |grep kvm kvm_intel              54285  0  kvm                   333172  1 kvm_intel [root@localhost iso]# virsh --version 0.10.2 [root@localhost iso]# virt-install --version 0.600.0 [root@localhost iso]# ln -s /usr/libexec/qemu-kvm /usr/bin/qemu-kvm 4、桥接网卡 cd /etc/sysconfig/network-scripts/ [root@localhost network-scripts]# cp ifcfg-eth0 ifcfg-br0  [root@localhost network-scripts]# echo "BRIDGE=br0" >> ifcfg-eth0 [root@localhost network-scripts]# cat ifcfg-br0  DEVICE="br0" BOOTPROTO="static" ONBOOT="yes" TYPE="Bridge" IPADDR=172.16.8.36 NETMASK=255.255.255.0 GATEWAY=172.16.8.1 [root@localhost network-scripts]# brctl show bridge name bridge id STP enabled interfaces br0 8000.7446a0f51698 no eth0 virbr0 8000.52540095e5ac yes virbr0-nic 查看网卡信息 [root@localhost network-scripts]# ifconfig 

    5、创建镜像 qemu-img create -f raw /data/nfyg/images/centos6.5-x86_64.raw 300G 6、创建KVM虚拟机 virt-install --name centos6.5-x86_64 --virt-type kvm --ram 16384  --cdrom=/data/nfyg/iso/CentOS-6.5-x86_64-bin-DVD1.iso --disk path=/data/nfyg/images/centos6.5-x86_64.raw --network network=default --graphics vnc,listen=0.0.0.0 --noautoconsole 1、查看所有虚拟机    virsh list --all  2、关闭虚拟机        virsh shutdown vm 3、强制关闭虚拟机    virsh destroy vm  4、开启虚拟机        virsh start vm 5、设置主机开机自启  virsh autostart vm 

    转载请注明原文地址: https://ju.6miu.com/read-678738.html

    最新回复(0)