vlambda博客
学习文章列表

CentOS8使用Libvirt实现虚拟化

  1. 安装包

[root@vm-mini~]# yum groupinstall "Virtualization Host" -y

Repositoryextras is listed more than once in the configuration

Last metadataexpiration check: 0:00:28 ago on Sat 17 Apr 2021 06:48:06 PM CST.

No match forgroup package "insights-client"

No match forgroup package "centos-release"

No match forgroup package "centos-release-eula"

Dependenciesresolved.

===========================================================================================================================

 Package                                      Arch      Version                                       Repository    Size

===========================================================================================================================

Upgrading:

 NetworkManager                                x86_64    1:1.26.0-12.el8_3                              base         2.4 M

 NetworkManager-adsl                           x86_64    1:1.26.0-12.el8_3                              base         138 k

 NetworkManager-bluetooth                      x86_64    1:1.26.0-12.el8_3                              base         164 k

 libvirt-bash-completion-6.0.0-28.1.module_el8.3.0+755+88436ea4.x86_64                                                   

 libvirt-client-6.0.0-28.1.module_el8.3.0+755+88436ea4.x86_64                                                            

 libvirt-daemon-config-nwfilter-6.0.0-28.1.module_el8.3.0+755+88436ea4.x86_64                                            

  scrub-2.5.2-14.el8.x86_64                                                                                               

 supermin-5.1.19-10.module_el8.3.0+555+a55c8938.x86_64                                                                   

  syslinux-6.04-4.el8.x86_64                                                                                              

  syslinux-extlinux-6.04-4.el8.x86_64                                                                                     

 syslinux-extlinux-nonlinux-6.04-4.el8.noarch                                                                            

  syslinux-nonlinux-6.04-4.el8.noarch                                                                                     

  virtio-win-1.9.14-4.el8.noarch                                                                                          

 

Complete!

 

 

  1. 查看安装完后

[root@server-3~]# virsh version

Compiledagainst library: libvirt 6.0.0

Usinglibrary: libvirt 6.0.0

Using API:QEMU 6.0.0

Runninghypervisor: QEMU 4.2.0

 

 

  1. 重新启动服务并设置为开机自启

[root@server-3 ~]# systemctl start libvirtd

[root@server-3 ~]# systemctl enable libvirtd

 

  1. 创建并启动虚拟机

[root@server-3 ~]# virt-manager

bash: virt-manager: command not found...
Install package 'virt-manager' toprovide command 'virt-manager'? [N/y] y
 
 
 * Waiting inqueue...
 * Loading listof packages....
The following packages have to be installed:
 python3-argcomplete-1.9.3-6.el8.noarch        Bashtab completion for argparse
 python3-libvirt-6.0.0-1.module_el8.3.0+555+a55c8938.x86_64        Thelibvirt virtualization API python3 binding
 virt-manager-2.2.1-3.el8.noarch        Desktoptool for managing virtual machines via libvirt
 virt-manager-common-2.2.1-3.el8.noarch        Commonfiles used by the different Virtual Machine Manager interfaces
Proceed with changes? [N/y] y
 
 
 * Waiting inqueue...
 * Waiting forauthentication...
 * Waiting inqueue...
 * Loading listof packages....
 * Downloadingpackages...
 * Requestingdata...
 * Testingchanges...
 * Installingpackages...

 

 


下载测试镜像,并放到/var/lib/libvirt/images目录下,这是KVM默认查找镜像文件的地方。

依次点击以下

点击Importexisting disk image --> Forward

CentOS8使用Libvirt实现虚拟化

 

点击Browse…

CentOS8使用Libvirt实现虚拟化

选择镜像--> Choose Volume

CentOS8使用Libvirt实现虚拟化

 

搜索Generic -->Forward

CentOS8使用Libvirt实现虚拟化

 

选择内存和CPU -->Forward

 

点击Finish