02 KVM安装虚拟化
文章目录
- 02 KVM安装虚拟化
- 2.1 最低硬件要求
- 2.2 安装虚拟化核心组件
- 2.2.1 安装方法
- 2.2.1.1 前提条件
- 2.2.1.2 安装步骤
- 2.2.2 验证安装是否成功
02 KVM安装虚拟化
2.1 最低硬件要求
在openEuler系统中安装虚拟化组件,最低硬件要求:
- AArch64处理器架构:ARMv8以上并且支持虚拟化扩展
- x86_64处理器架构:支持VT-x
- 2核CPU
- 4GB的内存
- 16GB可用磁盘空间
2.2 安装虚拟化核心组件
2.2.1 安装方法
2.2.1.1 前提条件
- 已经配置yum源。
- 安装操作需要root用户权限。
2.2.1.2 安装步骤
- 安装QEMU组件。
# dnf install -y qemu
示例命令如下:
[root@superman-21 ~]# dnf install -y qemu
Last metadata expiration check: 0:01:08 ago on 2023年02月04日 星期六 20时27分24秒.
Dependencies resolved.
============================================================================================================================Package Architecture Version Repository Size
============================================================================================================================
Installing:qemu x86_64 10:6.2.0-60.oe2203 update 5.8 M
Installing dependencies:CUnit x86_64 2.1.3-22.oe2203 OS 50 kdtc x86_64 1.6.1-1.oe2203 everything 95 klibiscsi x86_64 1.19.0-9.oe2203 update 89 kmultipath-tools x86_64 0.8.7-2.oe2203 OS 309 kqemu-block-curl x86_64 10:6.2.0-60.oe2203 update 38 kqemu-block-iscsi x86_64 10:6.2.0-60.oe2203 update 45 kqemu-hw-usb-host x86_64 10:6.2.0-60.oe2203 update 47 krdma-core x86_64 35.1-2.oe2203 OS 795 kvirglrenderer x86_64 0.8.2-3.oe2203 update 185 k
Installing weak dependencies:libiscsi-utils x86_64 1.19.0-9.oe2203 update 171 kTransaction Summary
============================================================================================================================
Install 11 PackagesTotal download size: 7.6 M
Installed size: 27 M
Downloading Packages:
(1/11): CUnit-2.1.3-22.oe2203.x86_64.rpm 211 kB/s | 50 kB 00:00
(2/11): dtc-1.6.1-1.oe2203.x86_64.rpm 831 kB/s | 95 kB 00:00
(3/11): multipath-tools-0.8.7-2.oe2203.x86_64.rpm 863 kB/s | 309 kB 00:00
(4/11): libiscsi-1.19.0-9.oe2203.x86_64.rpm 1.3 MB/s | 89 kB 00:00
(5/11): rdma-core-35.1-2.oe2203.x86_64.rpm 1.8 MB/s | 795 kB 00:00
(6/11): libiscsi-utils-1.19.0-9.oe2203.x86_64.rpm 1.3 MB/s | 171 kB 00:00
(7/11): qemu-block-curl-6.2.0-60.oe2203.x86_64.rpm 691 kB/s | 38 kB 00:00
(8/11): qemu-block-iscsi-6.2.0-60.oe2203.x86_64.rpm 729 kB/s | 45 kB 00:00
(9/11): qemu-hw-usb-host-6.2.0-60.oe2203.x86_64.rpm 781 kB/s | 47 kB 00:00
(10/11): virglrenderer-0.8.2-3.oe2203.x86_64.rpm 1.8 MB/s | 185 kB 00:00
(11/11): qemu-6.2.0-60.oe2203.x86_64.rpm 4.0 MB/s | 5.8 MB 00:01
----------------------------------------------------------------------------------------------------------------------------
Total 4.0 MB/s | 7.6 MB 00:01
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transactionPreparing : 1/1 Installing : rdma-core-35.1-2.oe2203.x86_64 1/11 Running scriptlet: rdma-core-35.1-2.oe2203.x86_64 1/11 Installing : virglrenderer-0.8.2-3.oe2203.x86_64 2/11 Running scriptlet: virglrenderer-0.8.2-3.oe2203.x86_64 2/11 Installing : qemu-hw-usb-host-10:6.2.0-60.oe2203.x86_64 3/11 Installing : qemu-block-curl-10:6.2.0-60.oe2203.x86_64 4/11 Running scriptlet: dtc-1.6.1-1.oe2203.x86_64 5/11 Installing : dtc-1.6.1-1.oe2203.x86_64 5/11 Running scriptlet: dtc-1.6.1-1.oe2203.x86_64 5/11 Installing : multipath-tools-0.8.7-2.oe2203.x86_64 6/11 Running scriptlet: multipath-tools-0.8.7-2.oe2203.x86_64 6/11 Running scriptlet: CUnit-2.1.3-22.oe2203.x86_64 7/11 Installing : CUnit-2.1.3-22.oe2203.x86_64 7/11 Installing : libiscsi-1.19.0-9.oe2203.x86_64 8/11 Running scriptlet: libiscsi-1.19.0-9.oe2203.x86_64 8/11 Installing : libiscsi-utils-1.19.0-9.oe2203.x86_64 9/11 Installing : qemu-block-iscsi-10:6.2.0-60.oe2203.x86_64 10/11 Running scriptlet: qemu-10:6.2.0-60.oe2203.x86_64 11/11 Installing : qemu-10:6.2.0-60.oe2203.x86_64 11/11 Running scriptlet: qemu-10:6.2.0-60.oe2203.x86_64 11/11 Verifying : CUnit-2.1.3-22.oe2203.x86_64 1/11 Verifying : multipath-tools-0.8.7-2.oe2203.x86_64 2/11 Verifying : rdma-core-35.1-2.oe2203.x86_64 3/11 Verifying : dtc-1.6.1-1.oe2203.x86_64 4/11 Verifying : libiscsi-1.19.0-9.oe2203.x86_64 5/11 Verifying : libiscsi-utils-1.19.0-9.oe2203.x86_64 6/11 Verifying : qemu-10:6.2.0-60.oe2203.x86_64 7/11 Verifying : qemu-block-curl-10:6.2.0-60.oe2203.x86_64 8/11 Verifying : qemu-block-iscsi-10:6.2.0-60.oe2203.x86_64 9/11 Verifying : qemu-hw-usb-host-10:6.2.0-60.oe2203.x86_64 10/11 Verifying : virglrenderer-0.8.2-3.oe2203.x86_64 11/11 Installed:CUnit-2.1.3-22.oe2203.x86_64 dtc-1.6.1-1.oe2203.x86_64 libiscsi-1.19.0-9.oe2203.x86_64 libiscsi-utils-1.19.0-9.oe2203.x86_64 multipath-tools-0.8.7-2.oe2203.x86_64 qemu-10:6.2.0-60.oe2203.x86_64 qemu-block-curl-10:6.2.0-60.oe2203.x86_64 qemu-block-iscsi-10:6.2.0-60.oe2203.x86_64 qemu-hw-usb-host-10:6.2.0-60.oe2203.x86_64 rdma-core-35.1-2.oe2203.x86_64 virglrenderer-0.8.2-3.oe2203.x86_64 Complete!
[root@superman-21 ~]#
- 安装libvirt组件。
# dnf install -y libvirt
示例命令如下:
[root@superman-21 ~]# dnf install -y libvirt
Last metadata expiration check: 0:02:00 ago on 2023年02月04日 星期六 20时27分24秒.
Dependencies resolved.
============================================================================================================================Package Architecture Version Repository Size
============================================================================================================================
Installing:libvirt x86_64 6.2.0-50.oe2203 update 70 k
Installing dependencies:augeas x86_64 1.13.0-3.oe2203 update 376 kautogen x86_64 5.18.16-2.oe2203 OS 464 kdnsmasq x86_64 2.86-2.oe2203 update 241 kfmt x86_64 8.0.1-1.oe2203 OS 101 kglusterfs x86_64 10.0-4.oe2203 OS 555 kglusterfs-cli x86_64 10.0-4.oe2203 OS 177 kglusterfs-client-xlators x86_64 10.0-4.oe2203 OS 807 kglusterfs-fuse x86_64 10.0-4.oe2203 OS 129 kgnutls-utils x86_64 3.7.2-2.oe2203 OS 243 kgperftools-libs x86_64 2.9.1-4.oe2203 OS 266 klibgfapi0 x86_64 10.0-4.oe2203 OS 83 klibgfrpc0 x86_64 10.0-4.oe2203 OS 51 klibgfxdr0 x86_64 10.0-4.oe2203 OS 26 klibglusterd0 x86_64 10.0-4.oe2203 OS 12 klibglusterfs0 x86_64 10.0-4.oe2203 OS 277 klibrados2 x86_64 2:16.2.7-14.oe2203 update 3.6 Mlibrbd1 x86_64 2:16.2.7-14.oe2203 update 3.8 Mlibvirt-bash-completion x86_64 6.2.0-50.oe2203 update 71 klibvirt-client x86_64 6.2.0-50.oe2203 update 367 klibvirt-daemon x86_64 6.2.0-50.oe2203 update 338 klibvirt-daemon-config-network x86_64 6.2.0-50.oe2203 update 72 klibvirt-daemon-config-nwfilter x86_64 6.2.0-50.oe2203 update 76 klibvirt-daemon-driver-interface x86_64 6.2.0-50.oe2203 update 206 klibvirt-daemon-driver-network x86_64 6.2.0-50.oe2203 update 231 klibvirt-daemon-driver-nodedev x86_64 6.2.0-50.oe2203 update 206 klibvirt-daemon-driver-nwfilter x86_64 6.2.0-50.oe2203 update 229 klibvirt-daemon-driver-qemu x86_64 6.2.0-50.oe2203 update 852 klibvirt-daemon-driver-secret x86_64 6.2.0-50.oe2203 update 196 klibvirt-daemon-driver-storage x86_64 6.2.0-50.oe2203 update 70 klibvirt-daemon-driver-storage-core x86_64 6.2.0-50.oe2203 update 247 klibvirt-daemon-driver-storage-disk x86_64 6.2.0-50.oe2203 update 80 klibvirt-daemon-driver-storage-gluster x86_64 6.2.0-50.oe2203 update 82 klibvirt-daemon-driver-storage-iscsi x86_64 6.2.0-50.oe2203 update 77 k
.
.
.libvirt-daemon-driver-qemu-6.2.0-50.oe2203.x86_64libvirt-daemon-driver-secret-6.2.0-50.oe2203.x86_64libvirt-daemon-driver-storage-6.2.0-50.oe2203.x86_64libvirt-daemon-driver-storage-core-6.2.0-50.oe2203.x86_64libvirt-daemon-driver-storage-disk-6.2.0-50.oe2203.x86_64libvirt-daemon-driver-storage-gluster-6.2.0-50.oe2203.x86_64libvirt-daemon-driver-storage-iscsi-6.2.0-50.oe2203.x86_64libvirt-daemon-driver-storage-iscsi-direct-6.2.0-50.oe2203.x86_64libvirt-daemon-driver-storage-logical-6.2.0-50.oe2203.x86_64libvirt-daemon-driver-storage-mpath-6.2.0-50.oe2203.x86_64libvirt-daemon-driver-storage-rbd-6.2.0-50.oe2203.x86_64libvirt-daemon-driver-storage-scsi-6.2.0-50.oe2203.x86_64libvirt-libs-6.2.0-50.oe2203.x86_64libxslt-1.1.34-8.oe2203.x86_64lttng-ust-2.10.1-11.oe2203.x86_64lzop-1.04-1.oe2203.x86_64netcf-0.2.8-20.oe2203.x86_64 numad-0.5-31.oe2203.x86_64open-iscsi-2.1.5-7.oe2203.x86_64open-isns-0.101-1.oe2203.x86_64open-isns-help-0.101-1.oe2203.noarchqemu-img-10:6.2.0-60.oe2203.x86_64radvd-2.19-2.oe2203.x86_64systemd-container-249-16.oe2203.x86_64yajl-2.1.0-18.oe2203.x86_64Complete!
[root@superman-21 ~]#
- 启动libvirtd服务。
# systemctl start libvirtd
示例命令如下:
[root@superman-21 ~]# systemctl start libvirtd
[root@superman-21 ~]#
说明:
KVM模块已经集成在openEuler内核中,因此不需要单独安装。
2.2.2 验证安装是否成功
- 查看内核是否支持KVM虚拟化,即查看/dev/kvm和/sys/module/kvm文件是否存在,命令和回显如下:
# ls /dev/kvm
示例命令如下:
[root@superman-21 ~]# ls /dev/kvm
/dev/kvm
[root@superman-21 ~]#
# ls /sys/module/kvm
示例命令如下:
[root@superman-21 ~]# ls /sys/module/kvm
coresize holders initsize initstate notes parameters refcnt sections srcversion taint uevent
[root@superman-21 ~]#
若上述文件存在,说明内核支持KVM虚拟化。若上述文件不存在,则说明系统内核编译时未开启KVM虚拟化,需要更换支持KVM虚拟化的Linux内核。
确认QEMU是否安装成功。
若安装成功则可以看到QEMU软件包信息:
# rpm -qi qemu
示例命令如下:
[root@superman-21 ~]# rpm -qi qemu
Name : qemu
Epoch : 10
Version : 6.2.0
Release : 60.oe2203
Architecture: x86_64
Install Date: 2023年02月04日 星期六 20时28分38秒
Group : Unspecified
Size : 21795130
License : GPLv2 and BSD and MIT and CC-BY-SA-4.0
Signature : RSA/SHA1, 2022年12月20日 星期二 15时48分21秒, Key ID d557065eb25e7f66
Source RPM : qemu-6.2.0-60.oe2203.src.rpm
Build Date : 2022年12月20日 星期二 08时00分00秒
Build Host : obs-worker1639015616-x86-0004
Packager : http://openeuler.org
Vendor : http://openeuler.org
URL : http://www.qemu.org
Summary : QEMU is a generic and open source machine emulator and virtualizer
Description :
QEMU is a FAST! processor emulator using dynamic translation to achieve good emulation speed.QEMU has two operating modes:Full system emulation. In this mode, QEMU emulates a full system (for example a PC),including one or several processors and various peripherals. It can be used to launchdifferent Operating Systems without rebooting the PC or to debug system code.User mode emulation. In this mode, QEMU can launch processes compiled for one CPU on another CPU.It can be used to launch the Wine Windows API emulator (https://www.winehq.org) or to easecross-compilation and cross-debugging.
You can refer to https://www.qemu.org for more infortmation.
[root@superman-21 ~]#
确认libvirt是否安装成功。
若安装成功则可以看到libvirt软件包信息:
# rpm -qi libvirt
示例命令如下:
[root@superman-21 ~]# rpm -qi libvirt
Name : libvirt
Version : 6.2.0
Release : 50.oe2203
Architecture: x86_64
Install Date: 2023年02月04日 星期六 20时29分36秒
Group : Unspecified
Size : 0
License : LGPLv2+
Signature : RSA/SHA1, 2023年01月05日 星期四 06时49分21秒, Key ID d557065eb25e7f66
Source RPM : libvirt-6.2.0-50.oe2203.src.rpm
Build Date : 2023年01月04日 星期三 08时00分00秒
Build Host : obs-worker-backend-test-x86-0006
Packager : http://openeuler.org
Vendor : http://openeuler.org
URL : https://libvirt.org/
Summary : Library providing a simple virtualization API
Description :
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.
[root@superman-21 ~]#
查看libvirt服务是否启动成功。
若服务处于“Active”状态,说明服务启动成功,可以正常使用libvirt提供的virsh命令行工具:
# systemctl status libvirtd
示例命令如下:
[root@superman-21 ~]# systemctl status libvirtd
○ libvirtd.service - Virtualization daemonLoaded: loaded (/usr/lib/systemd/system/libvirtd.service; enabled; vendor preset: enabled)Active: inactive (dead) since Sat 2023-02-04 20:37:24 CST; 6min ago
TriggeredBy: ● libvirtd.socket● libvirtd-ro.socket● libvirtd-admin.socketDocs: man:libvirtd(8)https://libvirt.orgProcess: 2104 ExecStart=/usr/sbin/libvirtd $LIBVIRTD_ARGS (code=exited, status=0/SUCCESS)Main PID: 2104 (code=exited, status=0/SUCCESS)Tasks: 2 (limit: 32768)Memory: 4.6MCGroup: /system.slice/libvirtd.service├─2208 /usr/sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-script=/usr/l>└─2209 /usr/sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-script=/usr/l>2月 04 20:35:25 superman-21 dnsmasq-dhcp[2208]: DHCP, IP range 192.168.122.2 -- 192.168.122.254, lease time 1h
2月 04 20:35:25 superman-21 dnsmasq-dhcp[2208]: DHCP, sockets bound exclusively to interface virbr0
2月 04 20:35:25 superman-21 dnsmasq[2208]: reading /etc/resolv.conf
2月 04 20:35:25 superman-21 dnsmasq[2208]: using nameserver 202.102.224.68#53
2月 04 20:35:25 superman-21 dnsmasq[2208]: read /etc/hosts - 2 addresses
2月 04 20:35:25 superman-21 dnsmasq[2208]: read /var/lib/libvirt/dnsmasq/default.addnhosts - 0 addresses
2月 04 20:35:25 superman-21 dnsmasq-dhcp[2208]: read /var/lib/libvirt/dnsmasq/default.hostsfile
2月 04 20:37:24 superman-21 systemd[1]: libvirtd.service: Deactivated successfully.
2月 04 20:37:24 superman-21 systemd[1]: libvirtd.service: Unit process 2208 (dnsmasq) remains running after unit stopped.
2月 04 20:37:24 superman-21 systemd[1]: libvirtd.service: Unit process 2209 (dnsmasq) remains running after unit stopped.
[root@superman-21 ~]#
02 KVM安装虚拟化相关推荐
- 烂泥:虚拟化KVM安装与配置
本文首发于烂泥行天下. 最近打算把公司的服务器全部做成虚拟化,一是跟有效的利用了服务器,二也是对自己是一个学习的机会. KVM的安装与配置步骤如下: 1. 查看是否支持虚拟化 2. 安装kvm及其所需 ...
- KVM虚拟化(2) | KVM安装部署 | 安装虚机Windows2012R2
目录 1.基础环境准备 2.KVM的安装 3.开启服务 4.开启图形化界面 5.也可以通过浏览器管理KVM 6.举例安装一个windows2012R2 1.基础环境准备 [关闭防火墙] systemc ...
- kvm安装完全版 rhel6
kvm安装完全版 主机最小化安装,另安装一台管理用的客户机 CPU: vendor_id : AuthenticAMD cpu family : 16 model ...
- rhel6.1 kvm安装virtio驱动
KVM: 安装Windows virtio半虚拟化驱动 Install KVM Windows virtio para-virtualized dirver 测试环境: 物理机: RHEL 6.1. ...
- Centos7的KVM安装配置详解
KVM和虚拟化 虚拟化有几种类型: 完全虚拟化(Full virtualization), 虚机使用原始版本的操作系统, 直接与CPU通信, 是速度最快的虚拟化. 半虚拟化(Paravirtualiz ...
- KVM安装和连接VNC
KVM安装 一 :简介 KVM自Linux 2.6.20版本后就直接整合到Linux内核,它依托CPU虚拟化指令集实现高性能的虚拟化支持.它与Linux内核高度整合,因此在性能.安全性.兼容性.稳定性 ...
- kvm安装及虚拟机创建
环境介绍: redhat6.5_x64 basic_server安装 iptables及selinux禁用 光盘作为yum源 1.BIOS开启虚拟化 Linux中x64的环境中才能使用kvm(如果是v ...
- KVM 安装windows 虚拟机
KVM 安装windows 虚拟机 家里有台linux电脑, 一直当文件服务器和下载机使用. 所谓下载机就是装1个xware用迅雷远程下载, 但是最近迅雷关闭了第三方机器的远程下载功能, 简单来将就是 ...
- 安装后改中文界面_非常详尽图文KVM安装CentOS
近日服务器安装了CentOS7.6系统,装了KVM,想装Linux虚拟服务器使用.本文图解说明KVM安装CentOS7.6操作系统的过程(介绍图形界面安装方式.命令行安装方式有空再写文介绍). 一.采 ...
最新文章
- ATS 5.3.0中利用grep得到纯净的配置文件
- 嵌入式系统学习笔记之五-uboot常用命令之补充
- python调用dll报错:ValueError: Procedure called with not enough arguments (4 bytes missing) or wrong call
- 深入理解pandas读取excel,txt,csv文件等命令
- spring-mvc注解
- 谈IE的浏览器模式和文档模式
- 【控制】《复杂运动体系统的分布式协同控制与优化》-方浩老师-第8章-固定翼飞行器的编队跟踪与姿态调节一体化控制
- bootstrap-datetimepicker bootstrap-datepicker bootstrap-timepicker 时间插件
- C++ 线程同步之临界区CRITICAL_SECTION
- java-生产者消费者模式
- C++/C--动态二维数组的内存分配与释放【转载】
- 矩阵平均路径长度_Android自定义View-路径动画
- NWT创业失败原因之层层分析
- mongodb在ubuntu下无法打开的问题
- mariadb mysql.h_MariaDB(MySQL)的常用命令1 【检索数据】
- 中国石油大学《思想道德修养与法律基础》第三阶段在线作业
- js根据年份计算年龄
- 主机托管的优势,为什么要选择主机托管
- Exception in thread “main“ java.lang.NoClassDefFoundError: org/apache/velocity/context/Context
- Linux 介绍快速浏览
热门文章
- POJ3420-Quad Tiling
- 三极管之开关电路(一)
- 简单的进制转换器(基于数据结构)
- 破解 expression blend 3 + sketchflow 注册码
- android 佳能 打印机,佳能(中国)- 打印机 - 喷墨机丰富功能 - Canon PRINT Inkjet/SELPHY移动打印...
- 天兔3.8安装 centos7
- 109个shell实用脚本
- MATLAB GUI界面编程——一些细节问题
- ff14显卡测试软件,FF14官方跑分软件
- qt链接mysql文件失败_【成功经验】QT读取access 2010的.accdb文件总是失败