kvm虚拟化管理平台WebVirtMgr部署-完整记录

kvm虚拟化管理平台WebVirtMgr部署-完整记录

打算部署kvm虚拟机环境,下面是虚拟化部署前的一些准备工作:

操作系统环境安装

1)修改内核模式为兼容内核启动

[root@ops~]#uname-a

Linuxopenstack2.6.32-431.el6.x86_64#1SMPFriNov2203:15:09UTC2013x86_64x86_64x86_64GNU/Linux

[root@ops~]#vim/boot/grub/grub.conf

......

default=1     #由默认的0改为1,内核兼容模式

2)关闭selinux,重启后生效

[root@ops~]#vim/etc/sysconfig/selinux

......

SELINUX=disabled

[root@ops~]#setenforce0

setenforce:SELinuxisdisabled

[root@ops~]#getenforce

Disabled

3)关闭防火墙

[root@ops~]#chkconfigip6tablesoff

[root@ops~]#chkconfigiptablesoff

4)重启

[root@ops~]#reboot

虚拟化环境配置

1)查看是否支持虚拟机

说明1:半虚拟化是不能运行与安装KVM虚拟机的。

[root@ops~]#egrep'(vmx|svm)'--color=always/proc/cpuinfo

2)配置yum环境,确认yum源是好使的。(这一步骤省略,可以用默认yum源,也可以换用163或阿里的yum源,只要能正常使用就行)

3)安装kvm软件包

[root@ops~]#yum-yinstallkvmpython-virtinstlibvirttunctlbridge-utilsvirt-managerqemu-kvm-toolsvirt-viewervirt-v2v

补充安装kvm虚拟化一些管理工具包

[root@ops~]#yum-yinstalllibguestfs-tools

---------------------------------------如果是centos7,操作如下---------------------------------------

yuminstallqemu-kvmlibvirtlibvirt-pythonlibguestfs-toolsvirt-installvirt-managerpython-virtinstlibvirt-clientvirt-viewer

systemctlenablelibvirtd&&systemctlstartlibvirtd

-----------------------------------------------------------------------------------------------------

查看虚拟化环境

1)查看虚拟机环境

[root@ops~]#/etc/init.d/libvirtdrestart

Stoppinglibvirtddaemon:[OK]

Startinglibvirtddaemon:[OK]

----------------------------------------------------------------------------------------------------------------------------------------------

启动的时候报错如下:

Startinglibvirtddaemon:libvirtd:relocationerror:libvirtd:symboldm_task_get_info_with_deferred_remove,versionBasenotdefinedinfilelibdevmapper.so.1.02withlinktimereference[FAILED]

解决办法:

yumupgradedevice-mapper-libs

----------------------------------------------------------------------------------------------------------------------------------------------

[root@ops~]#virsh-cqemu:///systemlist

IdNameState

----------------------------------------------------

2)查看kvm模块支持

[root@ops~]#lsmod|grepkvm

kvm_intel542850

kvm3331721kvm_intel

3)查看虚拟工具版本

[root@ops~]#virsh--version

0.10.2

[root@ops~]#virt-install--version

0.600.0

[root@ops~]#ln-s/usr/libexec/qemu-kvm/usr/bin/qemu-kvm

手动配置虚拟网桥

1)关闭networkmanager服务

[root@ops~]#chkconfigNetWorkManageroff

[root@ops~]#/etc/init.d/NetWorkManagerstop

2)创建br0网桥

[root@ops~]#cd/etc/sysconfig/network-scripts/

[root@ops~]#cpifcfg-em2ifcfg-br0#em2是本机内网网卡

[root@ops~]#catifcfg-em2

DEVICE=em2

HWADDR=44:A8:42:21:A6:01

TYPE=Ethernet

BRIDGE=br0#将em2添加到网桥br0内

UUID=6dbfbd49-b6b9-4c51-b2d2-b3ecbead82e9

ONBOOT=yes

IPADDR=192.168.1.17

GATEWAY=192.168.1.1

NM_CONTROLLED=no#一定设置为no!让em2不受networkmanager的控制

BOOTPROTO=static

[root@ops~]#catifcfg-br0

DEVICE=br0

HWADDR=44:A8:42:21:A6:01

TYPE=Bridge

UUID=6dbfbd49-b6b9-4c51-b2d2-b3ecbead82e9

ONBOOT=yes

IPADDR=192.168.1.17

GATEWAY=192.168.1.1

NM_CONTROLLED=no

BOOTPROTO=static

3)关闭了networkmanager服务之后,才能通过重启网卡服务管理网络。

[root@ops~]#/etc/init.d/networkrestart

4)查看网桥br0信息

[root@ops~]#ifconfig

br0Linkencap:EthernetHWaddr44:A8:42:21:A6:01

inetaddr:192.168.1.17Bcast:192.168.1.255Mask:255.255.255.0

inet6addr:fe80::46a8:42ff:fe21:a601/64Scope:Link

UPBROADCASTRUNNINGMULTICASTMTU:1500Metric:1

RXpackets:6642errors:0dropped:0overruns:0frame:0

TXpackets:12errors:0dropped:0overruns:0carrier:0

collisions:0txqueuelen:0

RXbytes:2146342(2.0MiB)TXbytes:720(720.0b)

em1Linkencap:EthernetHWaddr44:A8:42:21:A6:00

inetaddr:111.101.186.163Bcast:103.10.86.63Mask:255.255.255.192

inet6addr:fe80::46a8:42ff:fe21:a600/64Scope:Link

UPBROADCASTRUNNINGMULTICASTMTU:1500Metric:1

RXpackets:5877878errors:0dropped:0overruns:0frame:0

TXpackets:175381errors:0dropped:0overruns:0carrier:0

collisions:0txqueuelen:1000

RXbytes:921486122(878.7MiB)TXbytes:22894696(21.8MiB)

Interrupt:35

em2Linkencap:EthernetHWaddr44:A8:42:21:A6:01

inet6addr:fe80::46a8:42ff:fe21:a601/64Scope:Link

UPBROADCASTRUNNINGMULTICASTMTU:1500Metric:1

RXpackets:2412349errors:0dropped:0overruns:0frame:0

TXpackets:11errors:0dropped:0overruns:0carrier:0

collisions:0txqueuelen:1000

RXbytes:314457702(299.8MiB)TXbytes:872(872.0b)

Interrupt:38

loLinkencap:LocalLoopback

inetaddr:127.0.0.1Mask:255.0.0.0

inet6addr:::1/128Scope:Host

UPLOOPBACKRUNNINGMTU:16436Metric:1

RXpackets:238errors:0dropped:0overruns:0frame:0

TXpackets:238errors:0dropped:0overruns:0carrier:0

collisions:0txqueuelen:0

RXbytes:58469(57.0KiB)TXbytes:58469(57.0KiB)

virbr0Linkencap:EthernetHWaddr52:54:00:5F:95:B7#virbr0虚拟网卡有没有都不影响虚拟机的使用,有办法可以将其删除,但是保留也不影响~

inetaddr:192.168.122.1Bcast:192.168.122.255Mask:255.255.255.0

UPBROADCASTRUNNINGMULTICASTMTU:1500Metric:1

RXpackets:0errors:0dropped:0overruns:0frame:0

TXpackets:0errors:0dropped:0overruns:0carrier:0

collisions:0txqueuelen:0

RXbytes:0(0.0b)TXbytes:0(0.0b)

5)查看网桥

[root@ops~]#brctlshow

bridgenamebridgeidSTPenabledinterfaces

br08000.44a84221a601noem2

virbr08000.5254005f95b7yesvirbr0-nic

到此kvm虚拟化环境安装完毕。

相关推荐