KVM环境的搭建配置

KVM环境的搭建配置

参考资料:
https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/virtualization_deployment_and_administration_guide/index

实验环境:1.线下x86的RHEL7,RHEL8, CentOS7, CentOS8 服务器环境
2.因为VMware Workstation拥有嵌套虚拟化功能,故可以用来做测试

需要看实验的小伙伴可直接跳入2.2,然后直接跳到3.2正式开始

1.KVM虚拟化技术介绍

概述
KVM是基于内核的虚拟化技术(Kernel-based Virtual Machine),于2007年的Linux 2.6.20被合并进Linux内核。KVM要求CPU支持硬件虚拟化技术,即Intel的VT-x或AMD的AMD-V。
KVM相对裸机有2%以内的性能损耗,XEN相对裸机有2.5%的性能损耗。由于XEN需要修改Linux内核,而KVM是集成到每个Linux内核的、KVM相对XEN更加易用等原因,KVM已经成为大多数Linux系统的推荐默认虚拟化机制。
KVM只能完成CPU的虚拟化,而完整的硬件环境还需要网络、硬盘、键盘、鼠标等IO环境,这些硬件环境的模拟是通过QEMU-KVM完成的。

在这里插入图片描述

1).KVM是开源软件,全称是kernel-based virtual machine(基于内核的虚拟机)。
2).是x86架构且硬件支持虚拟化技术(如 intel VT 或 AMD-V)的Linux全虚拟化解决方案。
3).它包含一个为处理器提供底层虚拟化 可加载的核心模块kvm.ko(kvm-intel.ko或kvm-AMD.ko)。
4).KVM还需要一个经过修改的QEMU软件(qemu-kvm),作为虚拟机上层控制和界面。
5).KVM能在不改变linux或windows镜像的情况下同时运行多个虚拟机,(它的意思是多个虚拟机使用同一镜像)并为每一个虚拟机配置个性化硬件环境(网卡、磁盘、图形适配器……)。
6).在主流的Linux内核,如2.6.20以上的内核均已包含了KVM核心

2.环境准备

2.1 Host System Requirements

Minimum host system requirements
• 6 GB free disk space.
• 2 GB RAM.
Recommended system requirements
• One core or thread for each virtualized CPU and one for the host.
• 2 GB of RAM, plus additional RAM for virtual machines.
• 6 GB disk space for the host, plus the required disk space for the virtual machine(s).
Most guest operating systems require at least 6 GB of disk space. Additional storage space for each guest depends on their workload.
Swap space
Swap space in Linux is used when the amount of physical memory (RAM) is full. If the system needs more memory resources and the RAM is full, inactive pages in memory are moved to the swap space. While swap space can help machines with a small amount of RAM, it should not be considered a replacement for more RAM. Swap space is located on hard drives, which have a slower access time than physical memory. The size of your swap partition can be calculated from the physical RAM of the host. The Red Hat Customer Portal contains an article on safely and efficiently determining the size of the swap partition: https://access.redhat.com/site/solutions/15244.
o When using raw image files, the total disk space required is equal to or greater than the sum of the space required by the image files, the 6 GB of space required by the host operating system, and the swap space for the guest.
Equation 1.1. Calculating required space for guest virtual machines using raw images
total for raw format = images + hostspace + swap
For qcow images, you must also calculate the expected maximum storage requirements of the guest (total for qcow format), as qcow and qcow2 images are able to grow as required. To allow for this expansion, first multiply the expected maximum storage requirements of the guest (expected maximum guest storage) by 1.01, and add to this the space required by the host (host), and the necessary swap space (swap).
Equation 1.2. Calculating required space for guest virtual machines using qcow images
total for qcow format = (expected maximum guest storage * 1.01) + host + swap
Guest virtual machine requirements are further outlined in Chapter 7, Overcommitting with KVM.

2.2. KVM Hypervisor Requirements

CPU模块必须要有虚拟化功能才可以进行KVM的安装

The KVM hypervisor requires:
• an Intel processor with the Intel VT-x and Intel 64 virtualization extensions for x86-based systems; or
• an AMD processor with the AMD-V and the AMD64 virtualization extensions.
Virtualization extensions (Intel VT-x or AMD-V) are required for full virtualization. Enter the following commands to determine whether your system has the hardware virtualization extensions, and that they are enabled.
Procedure 1.1. Verifying virtualization extensions

1. Verify the CPU virtualization extensions are available

enter the following command to verify the CPU virtualization extensions are available:

$ grep -E 'svm|vmx' /proc/cpuinfo

在这里插入图片描述

2.Analyze the output

• The following example output contains a vmx entry, indicating an Intel processor with the Intel VT-x extension:
在这里插入图片描述

The following example output contains an svm entry, indicating an AMD processor with the AMD-V extensions:

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值