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

总结

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

相关内容

热门资讯

前端-session、jwt 目录:   (1)session (2&#x...
linux入门---制作进度条 了解缓冲区 我们首先来看看下面的操作: 我们首先创建了一个文件并在这个文件里面添加了...
关于测试,我发现了哪些新大陆 关于测试 平常也只是听说过一些关于测试的术语,但并没有使用过测试工具。偶然看到编程老师...
前缀和与对数器与二分法 1. 前缀和 假设有一个数组,我们想大量频繁的去访问L到R这个区间的和,...
nodejs:本地安装nvm实... 一、背景-使用不同版本node的原因 vue3+ts、nuxt3版本,node...
JAVA集合知识整理 Java集合知识整理 HashMap相关 HashMap的底层数据结构:jdk1.8之...
无刷直流电机介绍及单片机控制实... 无刷直流电机介绍及单片机控制实例前言基本概念优势与劣势使用寿命基本结构使用单片机控制实例电子调速器&...
fwdiary(2) dp2 1.传纸条  AcWing 275. 传纸条 - AcWing 走两条路,走一条最大的...
常用的DOS命令 常用的DOS命令 DOS(Disk Operating System,磁...
<C++> 类和对象(下) 1.const成员函数将const修饰的“成员函数”称之为const成员函数,cons...