安装Hypervisor软件
不同的操作系统安装Hypervisor软件的操作步骤不同,可直接参考表1直接跳转到对应的内容。
虚拟机操作系统 |
参考步骤 |
---|---|
openEuler 22.03 LTS openEuler 20.03 LTS BC Linux 8.2 BC Linux 21.10 CentOS 7.5(5.10.0) CULinux 3.0 Kylin V10 Kylin V10 SP2 Kylin V10 SP3 Tlinux3.1 UOS V20(1050e) UOS V20(1050u2e) |
|
Ubuntu 20.04 Ubuntu 22.04 veLinux 1.1 veLinux 1.1(5.10.200) |
|
Debian10.13 Debian10.8 Debian11.8 veLinux 1.2 |
openEuler 22.03 LTS/openEuler 20.03 LTS/Kylin V10 SP2/Kylin V10/BC Linux 21.10/UOS V20(1050e)/CULinux 3.0/CentOS 7.5(5.10.0)/Tlinux3.1/UOS V20(1050u2e)/Kylin V10 SP3/BC Linux 8.2
- 执行如下命令,安装必要的工具软件和库文件。
- 对于Tlinux3.1:请执行yum install -y libvirt* virt-install virt-viewer edk2*
- 对于BC Linux 8.2:
- 其他OS:请执行yum install -y libvirt* virt-install virt-viewer edk2* edk2-devel edk2-help
- openEuler 20.03 LTS/BC Linux 21.10在安装库文件时,若提示“Unable to find a match: virt-install”,请参见openEuler 20.03 LTS/BC Linux 21.10安装virt-install时出错,提示“Unable to find a match: virt-install”处理。
- CULinux 3.0在安装库文件时,若出现源代理过期或不可用,请替换成openEuler 22.03的源后执行yum install -y --nogpgcheck libvirt* virt-install virt-viewer edk2* edk2-devel edk2-help解决。
显示如下,表示安装成功。
Complete!
- 对于Kylin V10 SP2/Kylin V10 SP3,执行如下命令,安装QEMU。
yum install qemu
显示如下,表示安装成功。
Complete!
- 执行如下命令,重启libvirtd服务。
service libvirtd restart
不同的OS回显信息不同,具体回显信息请以实际环境为准。
Redirecting to /bin/systemctl restart libvirtd.service
- 执行如下命令,查看Hypervisor是否安装成功。
virsh version
显示如下,表示安装Hypervisor成功。具体版本号请以实际环境为准。
Compiled against library: libvirt 6.2.0 Using library: libvirt 6.2.0 Using API: QEMU 6.2.0 Running hypervisor: QEMU 6.2.0
Ubuntu 20.04/Ubuntu 22.04/veLinux 1.1/veLinux 1.1(5.10.200)
- 执行如下命令,安装virt-manager管理虚拟机。apt-get install -y virt-manager
Reading package lists... Done Building dependency tree Reading state information... Done The following additional packages will be installed: acl adwaita-icon-theme at-spi2-core dns-root-data dnsmasq-base fontconfig fontconfig-config fonts-dejavu-core genisoimage gir1.2-appindicator3-0.1 gir1.2-atk-1.0 gir1.2-freedesktop gir1.2-gdkpixbuf-2.0 gir1.2-glib-2.0 gir1.2-gstreamer-1.0 gir1.2-gtk-3.0 gir1.2-gtk-vnc-2.0 gir1.2-gtksource-4 gir1.2-libosinfo-1.0 gir1.2-libvirt-glib-1.0 gir1.2-pango-1.0 gir1.2-spiceclientglib-2.0
- 执行如下命令,查看virt-manager是否安装成功。
virt-manager --version
显示如下,表示安装成功。具体版本号请以实际环境为准。
2.2.1
- 执行如下命令,安装必要的工具软件和库文件。
apt-get install -y qemu-kvm libvirt-daemon-system libvirt-clients qemu-system virt-viewer
Reading package lists... Done Building dependency tree Reading state information... Done virt-viewer is already the newest version (7.0-2build1). virt-viewer set to manually installed. libvirt-clients is already the newest version (6.0.0-0ubuntu8.16).
- 执行如下命令,设置libvirtd开机自启动。
systemctl enable --now libvirtd
不同的OS回显信息不同,具体回显信息请以实际环境为准。
Synchronizing state of libvirtd.service with SysV service script with /lib/systemd/systemd-sysv-install. Executing: /lib/systemd/systemd-sysv-install enable libvirtd
- 执行如下命令,查询libvirtd的服务状态,确保服务为开机自启动。systemctl status libvirtd
● libvirtd.service - Virtualization daemon Loaded: loaded (/lib/systemd/system/libvirtd.service; enabled; vendor preset: enabled) Active: active (running) since Mon 2023-01-09 11:43:00 UTC; 6min ago TriggeredBy: ● libvirtd.socket ● libvirtd-admin.socket ● libvirtd-ro.socket ... Jan 09 11:43:01 atlas dnsmasq-dhcp[6455]: read /var/lib/libvirt/dnsmasq/default.hostsfile
Debian11.8/Debian10.13/veLinux 1.2/Debian10.8
- 执行如下命令,安装必要的工具软件和库文件。
apt install -y libvirt* qemu-kvm libvirt-daemon-system libvirt-clients qemu-system-arm virt-viewer virtinst
显示如下,表示安装成功。
Reading package lists... Done Building dependency tree... Done Reading state information... Done ... 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
若打印信息中提示:
Package qemu-kvm is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
cpu-checker
E: Package 'qemu-kvm' has no installation candidate
表示qemu-system-arm中已包含了qemu-kvm,可忽略此信息,执行apt install -y libvirt* libvirt-daemon-system libvirt-clients qemu-system-arm virt-viewer virtinst即可。
- 执行如下命令,重启libvirtd服务。
sudo service libvirtd restart
不同的OS回显信息不同,具体回显信息请以实际环境为准。
Redirecting to /bin/systemctl restart libvirtd.service
- 执行如下命令,查看Hypervisor是否安装成功。
virsh version
若显示如下,表示安装Hypervisor成功。具体版本号请以实际环境为准。
Compiled against library: libvirt 7.0.0 Using library: libvirt 7.0.0 Using API: QEMU 7.0.0 Running hypervisor: QEMU 4.1.0
- 执行如下命令,设置libvirtd开机自启动。
sudo systemctl enable --now libvirtd
不同的OS回显信息不同,具体回显信息请以实际环境为准。
Synchronizing state of libvirtd.service with SysV service script with /lib/systemd/systemd-sysv-install. Executing: /lib/systemd/systemd-sysv-install enable libvirtd
- 执行如下命令,查询libvirtd的服务状态,确保服务为开机自启动。
sudo systemctl status libvirtd
● libvirtd.service - Virtualization daemon Loaded: loaded (/lib/systemd/system/libvirtd.service; enabled; vendor preset: enabled) Active: active (running) since Mon 2024-05-27 22:37:51 CST; 7min ago TriggeredBy: ● libvirtd-ro.socket ... script=/usr/lib/libvirt/libvirt_> └─4826 /usr/sbin/libvirtd