服务器之家

服务器之家 > 正文

kvm虚拟化学习笔记(一)之kvm虚拟化环境安装的步骤

时间:2021-01-06 16:54     来源/作者:koumm

平时一直玩rhel/centos/oel系列的操作,玩虚拟化也是采这一类系统,kvm在rhel6系列操作系统支持比较好,本文采用采用oel6.3操作系统,网上所有文章都说kvm比xen简单,我怎么感觉kvm比较复杂,可能是它的工具太多了吧,所以决定开始记录kvm的学习过程。

1.操作系统安装

本文采用oel6.3x64操作系统,也可以采用rhel/centos6.x。

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

kvm虚拟化学习笔记(一)之kvm虚拟化环境安装的步骤

(2)关闭selinux,重启后生效

kvm虚拟化学习笔记(一)之kvm虚拟化环境安装的步骤

(3)关闭防火墙

?
1
2
chkconfig ip6tables off
chkconfig iptables off

(4)重启

?
1
# reboot

2.虚拟化环境配置

(1)查看是否支持虚拟机

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

?
1
#egrep '(vmx|svm)' --color=always /proc/cpuinfo

kvm虚拟化学习笔记(一)之kvm虚拟化环境安装的步骤

(2)配置yum环境

oel6.3已经配置好源,只需要开启即可。

kvm虚拟化学习笔记(一)之kvm虚拟化环境安装的步骤

(3)安装kvm软件包

?
1
#yum -y install kvm python-virtinst libvirt tunctl bridge-utils virt-manager qemu-kvm-tools virt-viewer virt-v2v

过程略。

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

?
1
#yum -y install libguestfs-tools
?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
loaded plugins: refresh-packagekit, security
setting up install process
resolving dependencies
--> running transaction check
---> package libguestfs-tools.x86_64 1:1.16.34-2.el6 will be installed
--> processing dependency: libguestfs-tools-c = 1:1.16.34-2.el6 for package: 1:libguestfs-tools-1.16.34-2.el6.x86_64
--> processing dependency: perl(xml::writer) for package: 1:libguestfs-tools-1.16.34-2.el6.x86_64
--> processing dependency: /usr/bin/guestmount for package: 1:libguestfs-tools-1.16.34-2.el6.x86_64
--> running transaction check
---> package libguestfs-tools-c.x86_64 1:1.16.34-2.el6 will be installed
--> processing dependency: libconfig.so.8()(64bit) for package: 1:libguestfs-tools-c-1.16.34-2.el6.x86_64
---> package perl-xml-writer.noarch 0:0.606-6.el6 will be installed
--> running transaction check
---> package libconfig.x86_64 0:1.3.2-1.1.el6 will be installed
--> finished dependency resolution
dependencies resolved
=====================================================================================================================
package             arch         version            repository        size
=====================================================================================================================
installing:
libguestfs-tools         x86_64        1:1.16.34-2.el6        ol6_latest        94 k
installing for dependencies:
libconfig            x86_64        1.3.2-1.1.el6         ol6_latest        50 k
libguestfs-tools-c        x86_64        1:1.16.34-2.el6        ol6_latest        850 k
perl-xml-writer         noarch        0.606-6.el6          ol6_latest        26 k
transaction summary
=====================================================================================================================
install    4 package(s)
total download size: 1.0 m
installed size: 3.6 m
is this ok [y/n]: y
downloading packages:
(1/4): libconfig-1.3.2-1.1.el6.x86_64.rpm                           | 50 kb   00:00
(2/4): libguestfs-tools-1.16.34-2.el6.x86_64.rpm                       | 94 kb   00:00
(3/4): libguestfs-tools-c-1.16.34-2.el6.x86_64.rpm                      | 850 kb   00:04
(4/4): perl-xml-writer-0.606-6.el6.noarch.rpm                         | 26 kb   00:00
---------------------------------------------------------------------------------------------------------------------
total                                        115 kb/s | 1.0 mb   00:08
running rpm_check_debug
running transaction test
transaction test succeeded
running transaction
installing : libconfig-1.3.2-1.1.el6.x86_64                                  1/4
installing : 1:libguestfs-tools-c-1.16.34-2.el6.x86_64                             2/4
installing : perl-xml-writer-0.606-6.el6.noarch                                3/4
installing : 1:libguestfs-tools-1.16.34-2.el6.x86_64                              4/4
verifying : perl-xml-writer-0.606-6.el6.noarch                                1/4
verifying : libconfig-1.3.2-1.1.el6.x86_64                                  2/4
verifying : 1:libguestfs-tools-c-1.16.34-2.el6.x86_64                             3/4
verifying : 1:libguestfs-tools-1.16.34-2.el6.x86_64                              4/4
installed:
libguestfs-tools.x86_64 1:1.16.34-2.el6
dependency installed:
libconfig.x86_64 0:1.3.2-1.1.el6 libguestfs-tools-c.x86_64 1:1.16.34-2.el6 perl-xml-writer.noarch 0:0.606-6.el6
complete!

 3.查看虚拟化环境

(1)查看虚拟机环境

kvm虚拟化学习笔记(一)之kvm虚拟化环境安装的步骤

(2)查看kvm模块支持

kvm虚拟化学习笔记(一)之kvm虚拟化环境安装的步骤

(3)查看虚拟工具版本

kvm虚拟化学习笔记(一)之kvm虚拟化环境安装的步骤

4.手动配置虚拟网桥

(1)关闭networkmanager服务

kvm虚拟化学习笔记(一)之kvm虚拟化环境安装的步骤

(2)创建br0网桥

?
1
2
3
4
[root@node1~]#cd /etc/sysconfig/network-scripts/
[root@node1network-scripts]#cp ifcfg-eth0 ifcfg-br0
[root@node1network-scripts]#
[root@node1network-scripts]#
?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
[root@node1network-scripts]#vi ifcfg-eth0
device="eth0"
bootproto=static
nm_controlled="no"
onboot=yes
type="ethernet"
bridge="br0"
uuid="99dde4d3-94f1-4293-b8a8-b10255d5b8be"
hwaddr=00:0c:29:47:41:8c
ipaddr=192.168.233.130
prefix=24
gateway=192.168.233.2
dns1=192.168.233.2
defroute=yes
ipv4_failure_fatal=yes
ipv6init=no
name="systemeth0"
[root@node1network-scripts]#
[root@node1network-scripts]#vi ifcfg-br0
device="br0"
bootproto=static
onboot=yes
type="bridge"
hwaddr=00:0c:29:47:41:8c
ipaddr=192.168.233.130
prefix=24
gateway=192.168.233.2
dns1=192.168.233.2

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

kvm虚拟化学习笔记(一)之kvm虚拟化环境安装的步骤

(4)查看网桥br0.

kvm虚拟化学习笔记(一)之kvm虚拟化环境安装的步骤

(4)查看网桥

kvm虚拟化学习笔记(一)之kvm虚拟化环境安装的步骤

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

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持服务器之家。

原文链接:http://koumm.blog.51cto.com/703525/1288795

标签:

相关文章

热门资讯

2020微信伤感网名听哭了 让对方看到心疼的伤感网名大全
2020微信伤感网名听哭了 让对方看到心疼的伤感网名大全 2019-12-26
Intellij idea2020永久破解,亲测可用!!!
Intellij idea2020永久破解,亲测可用!!! 2020-07-29
背刺什么意思 网络词语背刺是什么梗
背刺什么意思 网络词语背刺是什么梗 2020-05-22
歪歪漫画vip账号共享2020_yy漫画免费账号密码共享
歪歪漫画vip账号共享2020_yy漫画免费账号密码共享 2020-04-07
苹果12mini价格表官网报价 iPhone12mini全版本价格汇总
苹果12mini价格表官网报价 iPhone12mini全版本价格汇总 2020-11-13
返回顶部