在安装虚拟化环境的时候,首先查看下该服务器的硬件配置和环境,具体操作如下:
(一)检查硬件的相关情况:
1,查看cpu型号,物理cpu颗数,
1
2
3
4
5
[iyunv@KVM ~]# cat /proc/cpuinfo | grep name | cut -d: -f2 | uniq -c
2 Intel(R) Core(TM) i3-4150 CPU @ 3.50GHz
[iyunv@KVM ~]# 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,查看内存
1
2
3
4
5
[iyunv@KVM ~]# 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,查看其它的相关参数:
1
2
3
4
5
[iyunv@KVM ~]# dmidecode | grep -A16 "Memory Device" | grep Speed | sort -n | uniq -c
64 Speed: Unknown
[iyunv@KVM ~]# dmidecode|grep 'Maximum Capacity'
Maximum Capacity: 1 TB
[iyunv@KVM ~]#
(二)安装kvm
1,查看服务器是否支持虚拟化
[iyunv@KVM ~]# grep -E -o 'vmx|svm' /proc/cpuinfo
vmx
2,安装kvm软件包
1
[iyunv@KVM ~]# yum -y install kvm python-virtinst libvirt tunctl bridge-utils virt-manager qemu-kvm-tools virt-viewer virt-v2v
3,安装kvm虚拟化管理工具包
1
[iyunv@KVM ~]# yum install libguestfs-tools -y
4,查看虚拟机的相关环境
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
[iyunv@KVM ~]# /etc/init.d/libvirtd restart
Stopping libvirtd daemon: [ OK ]
Starting libvirtd daemon: [ OK ]
[iyunv@KVM ~]# virsh -c qemu:///system list
Id Name State
----------------------------------------------------
1 hadoop4 running
[iyunv@KVM ~]# virsh --version ###查看虚拟机的版本
0.10.2
[iyunv@KVM ~]# virt-install --version ###查看虚拟机工具的版本
0.600.0
[iyunv@KVM ~]# ln -s /usr/libexec/qemu-kvm /usr/bin/qemu-kvm
[iyunv@KVM ~]# 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
[iyunv@KVM ~]#
5,手动创建虚拟网桥:
a,首先NetworkManager服务:
[iyunv@KVM network-scripts]# /etc/init.d/NetworkManager status
NetworkManager (pid 1132) is running...
[iyunv@KVM network-scripts]# /etc/init.d/NetworkManager stop
Stopping NetworkManager daemon: [ OK ]
[iyunv@KVM network-scripts]# /etc/init.d/NetworkManager status
NetworkManager is stopped
[iyunv@KVM network-scripts]# chkconfig NetworkManager off
b,创建br0网桥:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
[iyunv@KVM network-scripts]# cp ifcfg-eth0 ifcfg-br0
[iyunv@KVM 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
1
2
3
4
5
6
7
8
9
10
11
12
13
[iyunv@KVM 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管理网络
运维网声明
1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网 享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com