centos6.x安装KVM

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 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值