Centos 8 stream x64安装KVM
创始人
2024-03-08 08:02:14
0

Centos 8 stream 安装kvm

提示:本次记录介绍根据在X86机器中,安装KVM服务的过程,仅供参考


提示:安装前需确保服务器可以支持与互联网互通,在安装过程中会需要下载外网依赖

Centos 8 stream 安装KVM

  • Centos 8 stream 安装kvm
  • 前言
  • 一、检查系统内核信息
    • 查询内核发行号
    • 查询内核名称
    • 主机的硬件架构名称
  • 二、检查本机是否支持虚拟化
    • cpu是否支持虚拟化或是否物理开启虚拟化
    • 使用
  • 安装
    • 安装kvm依赖
      • 采用yum方式安装
  • 启动 libvirtd
  • 总结


前言

提示:如下为本章主要示例:

例如:随着人工智能的不断发展,机器学习这门技术也越来越重要,很多人都开启了学习机器学习,本文就介绍了机器学习的基础内容。


提示:以下是本篇文章正文内容,下面案例可供参考

一、检查系统内核信息

查询内核发行号

uname -r
4.18.0-358.el8.x86_64

查询内核名称

uname -s
Linux

主机的硬件架构名称

uname -m
x86_64

二、检查本机是否支持虚拟化

cpu是否支持虚拟化或是否物理开启虚拟化

使用

grep -E '(vmx|svm)' /proc/cpuinfocat /proc/cpuinfo | grep vmx命令

grep -E '(vmx|svm)' /proc/cpuinfo
# 展示如下信息标识cpu支持虚拟化
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon rep_good nopl xtopology cpuid tsc_known_freq pni pclmulqdq vmx ssse3 fma cx16 pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm cpuid_fault invpcid_single pti ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid xsaveopt arat umip md_clear arch_capabilities
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon rep_good nopl xtopology cpuid tsc_known_freq pni pclmulqdq vmx ssse3 fma cx16 pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm cpuid_fault invpcid_single pti ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid xsaveopt arat umip md_clear arch_capabilities
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon rep_good nopl xtopology cpuid tsc_known_freq pni pclmulqdq vmx ssse3 fma cx16 pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm cpuid_fault invpcid_single pti ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid xsaveopt arat umip md_clear arch_capabilities
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon rep_good nopl xtopology cpuid tsc_known_freq pni pclmulqdq vmx ssse3 fma cx16 pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm cpuid_fault invpcid_single pti ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid xsaveopt arat umip md_clear arch_capabilities
cat /proc/cpuinfo | grep vmx
# 展示如下信息标识cpu支持虚拟化
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon rep_good nopl xtopology cpuid tsc_known_freq pni pclmulqdq vmx ssse3 fma cx16 pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm cpuid_fault invpcid_single pti ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid xsaveopt arat umip md_clear arch_capabilities
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon rep_good nopl xtopology cpuid tsc_known_freq pni pclmulqdq vmx ssse3 fma cx16 pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm cpuid_fault invpcid_single pti ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid xsaveopt arat umip md_clear arch_capabilities
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon rep_good nopl xtopology cpuid tsc_known_freq pni pclmulqdq vmx ssse3 fma cx16 pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm cpuid_fault invpcid_single pti ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid xsaveopt arat umip md_clear arch_capabilities
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon rep_good nopl xtopology cpuid tsc_known_freq pni pclmulqdq vmx ssse3 fma cx16 pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm cpuid_fault invpcid_single pti ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid xsaveopt arat umip md_clear arch_capabilities

安装

安装kvm依赖

采用yum方式安装

  • 安装前检查可以安装的版本
    显示安装的工具有:libvirt、virt-install、qemu-kvm、qeum-img、wget;下面我们一次对对各版本进行逐一验证
yum info libvirt
名称         : libvirt
版本         : 8.0.0
发布         : 10.module_el8.7.0+1218+f626c2ff
架构         : x86_64
大小         : 0.0  
源           : libvirt-8.0.0-10.module_el8.7.0+1218+f626c2ff.src.rpm
仓库         : @System
来自仓库     : appstream
概况         : Library providing a simple virtualization API
URL          : https://libvirt.org/
协议         : LGPLv2+
描述         : Libvirt is a C toolkit to interact with the virtualization capabilities: of recent versions of Linux (and other OSes). The main package includes: the libvirtd server exporting the virtualization support.
yum info virt-install
名称         : virt-install
版本         : 3.2.0
发布         : 4.el8
架构         : noarch
大小         : 33 k
源           : virt-manager-3.2.0-4.el8.src.rpm
仓库         : @System
来自仓库     : appstream
概况         : Utilities for installing virtual machines
URL          : https://virt-manager.org/
协议         : GPLv2+
描述         : Package includes several command line utilities, including virt-install: (build and install new VMs) and virt-clone (clone an existing virtual: machine).
yum info qemu-kvm
名称         : qemu-kvm
时期         : 15
版本         : 6.2.0
发布         : 20.module_el8.7.0+1218+f626c2ff.1
架构         : x86_64
大小         : 0.0  
源           : qemu-kvm-6.2.0-20.module_el8.7.0+1218+f626c2ff.1.src.rpm
仓库         : @System
来自仓库     : appstream
概况         : QEMU is a machine emulator and virtualizer
URL          : http://www.qemu.org/
协议         : GPLv2 and GPLv2+ and CC-BY
描述         : qemu-kvm is an open source virtualizer that provides hardware: emulation for the KVM hypervisor. qemu-kvm acts as a virtual: machine monitor together with the KVM kernel modules, and emulates the: hardware for a full system such as a PC and its associated peripherals.
yum info qeum-img
名称         : qemu-img
时期         : 15
版本         : 6.2.0
发布         : 20.module_el8.7.0+1218+f626c2ff.1
架构         : x86_64
大小         : 8.2 M
源           : qemu-kvm-6.2.0-20.module_el8.7.0+1218+f626c2ff.1.src.rpm
仓库         : @System
来自仓库     : appstream
概况         : QEMU command line tool for manipulating disk images
URL          : http://www.qemu.org/
协议         : GPLv2 and GPLv2+ and CC-BY
描述         : This package provides a command line tool for manipulating disk images.
yum info wget
名称         : wget
版本         : 1.19.5
发布         : 10.el8
架构         : x86_64
大小         : 2.8 M
源           : wget-1.19.5-10.el8.src.rpm
仓库         : @System
来自仓库     : appstream
概况         : A utility for retrieving files using the HTTP or FTP protocols
URL          : http://www.gnu.org/software/wget/
协议         : GPLv3+
描述         : GNU Wget is a file retrieval utility which can use either the HTTP or: FTP protocols. Wget features include the ability to work in the: background while you are logged out, recursive retrieval of: directories, file name wildcard matching, remote file timestamp: storage and comparison, use of Rest with FTP servers and Range with: HTTP servers to retrieve files over slow or unstable connections,: support for Proxy servers, and configurability.
  • 在线下载和安装

等待安装完成

yum install libvirt virt-install qemu-kvm wget -y
  • 验证安装结果
 yum list installed qemu-img wget libvirt virt-install qemu-kvm
已安装的软件包
libvirt.x86_64                                               8.0.0-10.module_el8.7.0+1218+f626c2ff                                                @appstream
qemu-img.x86_64                                              15:6.2.0-20.module_el8.7.0+1218+f626c2ff.1                                           @appstream
qemu-kvm.x86_64                                              15:6.2.0-20.module_el8.7.0+1218+f626c2ff.1                                           @appstream
virt-install.noarch                                          3.2.0-4.el8                                                                          @appstream
wget.x86_64                                                  1.19.5-10.el8                                                                        @appstream

启动 libvirtd

systemctl start libvirtd.service

查看运行状态

systemctl status libvirtd.service
libvirtd.service - Virtualization daemonLoaded: loaded (/usr/lib/systemd/system/libvirtd.service; enabled; vendor preset: enabled)Active: active (running) since Thu 2022-12-01 05:57:34 UTC; 2s agoDocs: man:libvirtd(8)https://libvirt.orgMain PID: 320125 (libvirtd)Tasks: 21 (limit: 32768)Memory: 16.6MCGroup: /system.slice/libvirtd.service├─ 78916 /usr/sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-script=/usr/libexec/libvirt_leaseshelper├─ 78917 /usr/sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-script=/usr/libexec/libvirt_leaseshelper└─320125 /usr/sbin/libvirtd --timeout 12012月 01 05:57:34 wcuu-nat-7230394803.local systemd[1]: This usually indicates unclean termination of a previous run, or service implementation deficiencies.
12月 01 05:57:34 wcuu-nat-7230394803.local systemd[1]: libvirtd.service: Found left-over process 78917 (dnsmasq) in control group while starting unit. Igno>
12月 01 05:57:34 wcuu-nat-7230394803.local systemd[1]: This usually indicates unclean termination of a previous run, or service implementation deficiencies.
12月 01 05:57:34 wcuu-nat-7230394803.local systemd[1]: Starting Virtualization daemon...
12月 01 05:57:34 wcuu-nat-7230394803.local systemd[1]: Started Virtualization daemon.
12月 01 05:57:35 wcuu-nat-7230394803.local dnsmasq[78916]: read /etc/hosts - 6 addresses
12月 01 05:57:35 wcuu-nat-7230394803.local dnsmasq[78916]: read /var/lib/libvirt/dnsmasq/default.addnhosts - 0 addresses
12月 01 05:57:35 wcuu-nat-7230394803.local dnsmasq-dhcp[78916]: read /var/lib/libvirt/dnsmasq/default.hostsfile

总结

任何事情可繁可简,重在与你如何看待它。

相关内容

热门资讯

AWSECS:访问外部网络时出... 如果您在AWS ECS中部署了应用程序,并且该应用程序需要访问外部网络,但是无法正常访问,可能是因为...
AWSElasticBeans... 在Dockerfile中手动配置nginx反向代理。例如,在Dockerfile中添加以下代码:FR...
银河麒麟V10SP1高级服务器... 银河麒麟高级服务器操作系统简介: 银河麒麟高级服务器操作系统V10是针对企业级关键业务...
北信源内网安全管理卸载 北信源内网安全管理是一款网络安全管理软件,主要用于保护内网安全。在日常使用过程中,卸载该软件是一种常...
AWR报告解读 WORKLOAD REPOSITORY PDB report (PDB snapshots) AW...
AWS管理控制台菜单和权限 要在AWS管理控制台中创建菜单和权限,您可以使用AWS Identity and Access Ma...
​ToDesk 远程工具安装及... 目录 前言 ToDesk 优势 ToDesk 下载安装 ToDesk 功能展示 文件传输 设备链接 ...
群晖外网访问终极解决方法:IP... 写在前面的话 受够了群晖的quickconnet的小水管了,急需一个新的解决方法&#x...
不能访问光猫的的管理页面 光猫是现代家庭宽带网络的重要组成部分,它可以提供高速稳定的网络连接。但是,有时候我们会遇到不能访问光...
Azure构建流程(Power... 这可能是由于配置错误导致的问题。请检查构建流程任务中的“发布构建制品”步骤,确保正确配置了“Arti...