KVM虚拟化笔记------kvm虚拟化环境安装
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了KVM虚拟化笔记------kvm虚拟化环境安装相关的知识,希望对你有一定的参考价值。
在安装虚拟化环境的时候,首先查看下该服务器的硬件配置和环境,具体操作如下:
(一)检查硬件的相关情况:
1,查看cpu型号,物理cpu颗数,
[[email protected] ~]# cat /proc/cpuinfo | grep name | cut -d: -f2 | uniq -c 2 Intel(R) Core(TM) i3-4150 CPU @ 3.50GHz [[email protected] ~]# cat /proc/cpuinfo | grep physical | sort -n | uniq -c 2 address sizes : 42 bits physical, 48 bits virtual 16 physical id : 0 ###说明有一颗cpu,颗数是从0开始的
2,查看内存
[[email protected] ~]# dmidecode|grep -A5 "Memory Device"|grep Size | cut -d: -f2 | sort -n | uniq -c 63 No Module Installed 63 1 kB 1 8 GB 1 8192 MB ###接了一根内存,每根内存的大小为8G
3,查看其它的相关参数:
[[email protected] ~]# dmidecode | grep -A16 "Memory Device" | grep Speed | sort -n | uniq -c 64 Speed: Unknown [[email protected] ~]# dmidecode|grep ‘Maximum Capacity‘ Maximum Capacity: 1 TB [[email protected] ~]#
(二)安装kvm
1,查看服务器是否支持虚拟化
[[email protected] ~]# grep -E -o ‘vmx|svm‘ /proc/cpuinfo
vmx
2,安装kvm软件包
[[email protected] ~]# yum -y install kvm python-virtinst libvirt tunctl bridge-utils virt-manager qemu-kvm-tools virt-viewer virt-v2v
3,安装kvm虚拟化管理工具包
[[email protected] ~]# yum install libguestfs-tools -y
4,查看虚拟机的相关环境
[[email protected] ~]# /etc/init.d/libvirtd restart Stopping libvirtd daemon: [ OK ] Starting libvirtd daemon: [ OK ] [[email protected] ~]# virsh -c qemu:///system list Id Name State ---------------------------------------------------- 1 hadoop4 running [[email protected] ~]# virsh --version ###查看虚拟机的版本 0.10.2 [[email protected] ~]# virt-install --version ###查看虚拟机工具的版本 0.600.0 [[email protected] ~]# ln -s /usr/libexec/qemu-kvm /usr/bin/qemu-kvm [[email protected] ~]# qemu-kvm -version QEMU PC emulator version 0.12.1 (qemu-kvm-0.12.1.2-2.479.el6_7.3), Copyright (c) 2003-2008 Fabrice Bellard [[email protected] ~]#
5,手动创建虚拟网桥:
a,首先NetworkManager服务:
[[email protected] network-scripts]# /etc/init.d/NetworkManager status
NetworkManager (pid 1132) is running...
[[email protected] network-scripts]# /etc/init.d/NetworkManager stop
Stopping NetworkManager daemon: [ OK ]
[[email protected] network-scripts]# /etc/init.d/NetworkManager status
NetworkManager is stopped
[[email protected] network-scripts]# chkconfig NetworkManager off
b,创建br0网桥:
[[email protected] network-scripts]# cp ifcfg-eth0 ifcfg-br0 [[email protected] network-scripts]# vi ifcfg-eth0 DEVICE=eth0 HWADDR=00:0C:29:75:92:CF TYPE=Ethernet ONBOOT=yes NM_CONTROLLED=no BOOTPROTO=static BRIDGE=br0 DEFROUTE=yes NAME=Systemeth0 IPADDR=10.1.156.200 NETMASK=255.255.255.0 GATEWAY=10.1.156.1 DNS1=10.1.156.1
[[email protected] network-scripts]# vi ifcfg-br0 UUID=c12c5da8-e4dd-43e0-a5cb-2c5491d68aff DEVICE=br0 ###修改为:br0 HWADDR=00:0C:29:75:92:CF ###不变 TYPE=Bridge ###把Ethernet变成Bridge ONBOOT=yes NM_CONTROLLED=yes BOOTPROTO=static IPADDR=10.1.156.201 ###修改下ip NETMASK=255.255.255.0 GATEWAY=10.1.156.1 DNS1=10.1.156.1
c,关闭了networkmanager服务之后,才能通过service networkrestart管理网络
本文出自 “清风明月” 博客,请务必保留此出处http://liqingbiao.blog.51cto.com/3044896/1740516
以上是关于KVM虚拟化笔记------kvm虚拟化环境安装的主要内容,如果未能解决你的问题,请参考以下文章