2 Installing KVM User Space Packages

This chapter describes how to configure the appropriate ULN channels or yum repositories and how to install user space tools to manage a standalone instance of KVM. A final check is performed to validate whether the system can host guest VMs.

Configuring Yum Repositories and ULN Channels

Virtualization packages and their dependencies are available in various locations on the Oracle Linux yum server and on the Unbreakable Linux Network (ULN), depending on Oracle Linux release, the system architecture, and use case, or support requirements.

Oracle Linux 7

Due to the availability of several very different kernel versions and the requirement for more recent versions of user space tools that may break compatibility with RHCK, there are several different yum repositories and ULN channels across the different supported architectures for Oracle Linux 7. Packages in the different channels have different use cases and different levels of support. This section describes the available yum repositories and ULN channels for each architecture.

Repositories and Channels That Are Available for x86_64 Platforms

Yum Repositories ULN Channels Description

ol7_latest

ol7_x86_64_latest

The virtualization packages that are provided in this repository or ULN channel maximize compatibility with RHCK and with Red Hat Enterprise Linux. Packages from this repository or ULN channel are fully supported for all kernels.

ol7_kvm_utils

ol7_x86_64_kvm_utils

The virtualization packages that are provided in this repository or ULN channel take advantage of newer features and functionality available in upstream packages. These packages are also engineered to work with KVM features that are enabled in the latest releases of UEK. If you install these packages, you must also install the latest version of either UEK R4 or UEK R5.

Note:

The ol7_kvm_utils and ol7_x86_64_kvm_utils channels distribute 64-bit packages only. If you manually installed any 32-bit packages, for example, libvirt-client, yum updates from these channels will fail. To use the ol7_kvm_utils and ol7_x86_64_kvm_utils channels, you must first remove any 32-bit versions of the packages distributed by these channels that are installed on your system.

You may choose to configure on-premises virtualization the same way that you configure systems on Oracle Cloud Infrastructure or other Oracle products that use KVM. Oracle Linux provides specific virtualization packages in this channel to assist with the configuration.

Packages in this channel are delivered with limited support. Limited support coverage is only available for packages that are tested on Oracle Linux 7 with UEK. The following are the limitations and requirements:

  • A minimum of Oracle Linux 7.4 is required.

  • A minimum of Unbreakable Enterprise Kernel Release 4 is required.

  • Guest operating systems, as supported on Oracle Cloud Infrastructure and described at https://docs.oracle.com/iaas/Content/Compute/References/images.htm.

  • KVM guests boot by using iSCSI, VirtIO, VirtIO-SCSI or IDE device emulation.

ol7_developer

ol7_developer_kvm_utils

ol7_x86_64_developer

ol7_x86_64_developer_kvm_utils

The virtualization packages that are provided in these repositories or ULN channels take advantage of newer features and functionality that is available upstream, but are unsupported and are made available for developer use only.

If you are using the Oracle Linux yum server, you can configure these repositories by installing the oraclelinux-developer-release-el7 package and then enabling these repositories by editing the repository files or by using yum-config-manager.

Repositories and Channels That Are Available for aarch64 Platforms

Yum Repositories ULN Channels Description

ol7_latest

ol7_aarch64_latest

The virtualization packages that are provided in this repository or ULN channel include the latest virtualization packages, which are available and fully supported on Unbreakable Enterprise Kernel Release 5.

ol7_developer

ol7_aarch64_developer

The virtualization packages that are provided in this repository or ULN channel take advantage of newer features and functionality, which are available upstream, but are unsupported and are made available for developer use only.

Caution:

Virtualization packages may also be available in the ol7_developer_EPEL yum repository or the ol7_arch_developer_EPEL ULN channel. These packages are unsupported and contain features that might never be tested on Oracle Linux and may conflict with virtualization packages from other channels. If you intend to use packages from any of the repositories or channels that are previously listed, first uninstall any virtualization packages that installed from this repository. You can also disable this repository or channel or set exclusions to prevent virtualization packages from being installed from this repository.

Depending on your use case and support requirements, you must enable the repository or ULN channel that you require before installing the virtualization packages from that repository or ULN channel.

Subscribing to ULN Channels

If you're using ULN, follow these steps to ensure that the system is registered with ULN and that the appropriate channel is enabled:

  1. Sign in to https://linux.oracle.com with your ULN username and password.

  2. On the Systems tab, from the list of registered systems, select the link name for the specified system.

  3. On the System Details page, select Manage Subscriptions.

  4. On the System Summary page, from the list of available channels, select each of the required channels, then click the right arrow to move each channel to the list of subscribed channels.

  5. Click Save Subscriptions.

Enabling Yum Repositories

If you're using the Oracle Linux yum server, you can either edit the repository configuration files in /etc/yum.repos.d/ directly; or, if you have the yum-utils package installed, you can use the yum-config-manager command, for example:

sudo yum-config-manager --enable ol7_kvm_utils ol7_UEKR6

To prevent yum from installing the package versions from a particular repository, you can set an exclude option on these packages for that repository. For example, to prevent yum from installing the virtualization packages in the ol7_developer_EPEL repository, use the following command:

sudo yum-config-manager --setopt="ol7_developer_EPEL.exclude=libvirt* qemu*" --save

Oracle Linux 8

The number of options available on Oracle Linux 8 are significantly reduced as the available kernels are newer and there are less options from which to choose.

Repositories and Channels That Are Available for Oracle Linux 8

Yum Repositories ULN Channels Description

ol8_appstream

ol8_x86_64_appstream

ol8_aarch64_appstream

The virtualization packages that are provided in this repository or ULN channel maximize compatibility with RHCK and with Red Hat Enterprise Linux. Packages from this repository or ULN channel are fully supported for all kernels.

Packages released in this repository or ULN channel are released as part of the default DNF module: virt

ol8_kvm_appstream

ol8_x86_64_kvm_appstream

ol8_aarch64_kvm_appstream

The virtualization packages that are provided in this repository or ULN channel take advantage of newer features and functionality available in upstream packages. These packages are also engineered to work with KVM features that are enabled in the latest releases of UEK. If you install these packages, you must also install the latest version of UEK R6 to use these features.

The Oracle KVM stack packages released in this repository or ULN channel are available as a separate DNF module streams: virt:kvm_utils and virt:kvm_utils2.

Additionally, some associated non-modular packages, such as virt-manager, edk2, swtpm and libtpms are available within this repository or channel. Packages that are included here are either not available in the standard AppStream repository or are available at a more recent version to take advantage of newer functionality.

See Switching Application Streams on Oracle Linux 8 for more information.

Because the Application Stream repository or channel is required for system software on Oracle Linux 8, it's enabled by default on any Oracle Linux 8 system.

If you intend to use the virt:kvm_utils2 application stream for improved functionality and integration with newer features released within UEK, you must subscribe to the ol8_kvm_appstream yum repository or ol8_base_arch_kvm_utils ULN channel. Note that the virt:kvm_utils application stream is now a legacy stream on Oracle Linux 8.

Subscribing to ULN Channels

If you're using ULN, follow these steps to ensure that the system is registered with ULN and that the appropriate channel is enabled:

  1. Sign in to https://linux.oracle.com with your ULN username and password.

  2. On the Systems tab, from the list of registered systems, select the link name for the specified system.

  3. On the System Details page, select Manage Subscriptions.

  4. On the System Summary page, from the list of available channels, select each of the required channels, then click the right arrow to move each channel to the list of subscribed channels.

  5. Click Save Subscriptions.

Enabling Yum Repositories

If you're using the Oracle Linux yum server, ensure that you have installed the most recent version of the oraclelinux-release-el8 package and enable the required repositories. For example:

sudo dnf install -y oraclelinux-release-el8
sudo dnf config-manager --enable ol8_appstream ol8_kvm_appstream

Oracle Linux 9

The number of options available on Oracle Linux 9 are significantly reduced as the available kernels are newer and there are less options from which to choose. Note also that unlike Oracle Linux 8, the packages for Oracle Linux 9 aren't released as part of a DNF module.

Repositories and Channels That Are Available for Oracle Linux 9

Yum Repositories ULN Channels Description

ol9_appstream

ol9_x86_64_appstream

ol9_aarch64_appstream

The virtualization packages that are provided in this repository or ULN channel maximize compatibility with RHCK and with Red Hat Enterprise Linux. Packages from this repository or ULN channel are fully supported for all kernels.

ol9_kvm_utils

ol9_x86_64_kvm_utils

ol9_aarch64_kvm_utils

The virtualization packages that are provided in this repository or ULN channel take advantage of newer features and functionality available in upstream packages. These packages are also engineered to work with KVM features that are enabled in the latest releases of UEK. If you install these packages, you must also install the latest version of either UEK R7.

Note:

You must remove all existing virtualization packages before enabling this channel or repository.

Because the Application Stream repository or channel is required for system software on Oracle Linux 9, it's enabled by default on any Oracle Linux 9 system.

Subscribing to ULN Channels

If you're using ULN, follow these steps to ensure that the system is registered with ULN and that the appropriate channel is enabled:

  1. Sign in to https://linux.oracle.com with your ULN username and password.

  2. On the Systems tab, from the list of registered systems, select the link name for the specified system.

  3. On the System Details page, select Manage Subscriptions.

  4. On the System Summary page, from the list of available channels, select each of the required channels, then click the right arrow to move each channel to the list of subscribed channels.

  5. Click Save Subscriptions.

Enabling Yum Repositories

If you're using the Oracle Linux yum server, ensure that you have installed the most recent version of the oraclelinux-release-el9 package and enable the required repositories. For example:

sudo dnf install -y oraclelinux-release-el9
sudo dnf config-manager --enable ol9_kvm_utils ol9_UEKR7

Installing Virtualization Packages

Virtualization packages provide an interface to the KVM hypervisor, and user-space tools.

Installing Virtualization Packages During an Oracle Linux System Installation

You can use the following procedures to install virtualization packages during system installation. The Anaconda installation program can be used to install a single virtualization host. You can use a kickstart file to install virtualization hosts over the network.

Note that installation of virtualization software during system install on Oracle Linux 8 defaults to a KVM stack most compatible with RHCK. To use an alternate KVM stack you might need to perform steps to add other yum or dnf configuration and if you're running Oracle Linux 8 you might need to select an alternate application stream for the installation.

Using the Installation Program to Install Virtualization Hosts

The following steps describe how to install a virtualization host with the Oracle Linux graphical installation program:

  1. Boot the Oracle Linux installation media and proceed to the Software Selection screen.

  2. Select one of the following virtualization host types:

    • Minimum Virtualization Host

      (Available on Oracle Linux 7, Oracle Linux 8, and Oracle Linux 9)

      1. Select Virtualization Host in the Base Environment section.

      2. Select Virtualization Host in the Add-ons for Selected Environment section.

    • Virtualization Host with GUI

      (Not available on Oracle Linux 8)

      1. Select Server with GUI in the Base Environment section.

      2. Select the following package groups in the Add-ons for Selected Environment section:

        • Virtualization Client

        • Virtualization Hypervisor

        • Virtualization Tools

  3. Follow the prompts to complete the installation.

Using a Kickstart File to Install Virtualization Hosts

You can install virtualization hosts by specifying individual packages or package groups in the %packages section of a kickstart file.

Specify virtualization packages individually, as in the following example:

%packages
libvirt
qemu-kvm
virt-install

Specify the appropriate package groups for the installation type in the %packages section of the kickstart file by using the @GroupID format:

Minimum Virtualization Host
%packages
@virtualization-hypervisor
@virtualization-tools
# The following group is optional. Uncomment line to include...:
#@virtualization-platform
Virtualization Host with GUI
%packages
@virtualization-hypervisor
@virtualization-client
@virtualization-platform
@virtualization-tools

Installing Virtualization Packages on an Existing System

  1. Log into the target Oracle Linux system with a user that has administrative privileges.

  2. Ensure that the system has the appropriate yum repository or ULN channel enabled for the virtualization package versions that you want to install. See Configuring Yum Repositories and ULN Channels for more information.

    Note:

    If the target host system is running Oracle Linux 9 and you intend to use the virtualization packages available in ol9_kvm_utils. You must first remove any existing virtualization packages that might already be installed:
    1. Run the following command to remove packages:
      sudo dnf remove libvirt qemu-kvm edk2
    2. Enable the ol9_kvm_utils and ol9_UEKR7 repositories:
      sudo dnf config-manager --enable ol9_kvm_utils ol9_UEKR7
  3. Update the system so that it has the most recent packages available.

    • If you're using Oracle Linux 7, run the yum update command.

    • If you're using Oracle Linux 8 or Oracle Linux 9, run the dnf update command.

  4. Install virtualization packages on the system.

    • If you're using Oracle Linux 7 run the following commands to install the base virtualization packages and other utilities:

      sudo yum groupinstall "Virtualization Host"
      sudo yum install qemu-kvm virt-install virt-viewer
    • If you're using Oracle Linux 8 run the following commands to install the base virtualization packages and other utilities:

      sudo dnf module install virt
      sudo dnf install virt-install virt-viewer

      See also Switching Application Streams on Oracle Linux 8.

    • If you're using Oracle Linux 9 run the following commands to install the base virtualization packages and other utilities:

      sudo dnf group install "Virtualization Host"
      sudo dnf install qemu-kvm virt-install virt-viewer

      More steps are required to start virtualization services on Oracle Linux 9 after installation. For more details, see Validating the Host System.

Upgrading Virtualization Packages

Virtualization packages are updated by using the standard yum update or dnf update command. Note that to change the versions of the virtualization packages to match the versions that are shipped in a particular yum repository or ULN channel, you might need to specify the channel or repository from or to which you're installing packages. For example, you would update to the latest available virtualization packages that are available in the ol7_kvm_utils repository as follows:

sudo yum --disablerepo="*" --enablerepo="ol7_kvm_utils" update

To downgrade packages to a version in an alternate repository or channel, you must first remove the existing packages before installing the packages from the alternate repository. For example, to downgrade from the virtualization packages in the ol7_kvm_utils repository to the version of the same packages in the ol7_latest repository:

sudo yum remove libvirt* qemu* virt-install
sudo yum --disablerepo="*" --enablerepo="ol7_latest" install libvirt qemu-kvm virt-install

Switching Application Streams on Oracle Linux 8

Virtualization packages on Oracle Linux 8 are released as a DNF module: virt. The default stream in the module contains packages that can work with both RHCK and UEK. Alternate versions of the packages that can take advantage of features that are only in UEK are available within a separate application stream, virt:kvm_utils2, that's provided along with some newer versions of non-modular packages within the ol8_kvm_appstream repository.

For more information about DNF modules and application streams, see Oracle Linux: Managing Software on Oracle Linux.

Switching to the Oracle KVM Stack

On an existing Oracle Linux 8 system, you can switch from the default KVM stack to the Oracle KVM stack in the virt:kvm_utils2 stream by performing the following steps:

  1. Remove any packages from the existing default virt stream:

    sudo dnf module remove virt -y --all
  2. Reset the virt module state so that it's neither enabled nor disabled:

    sudo dnf module reset virt -y
  3. Enable the virt:kvm_utils2 module and stream:

    sudo dnf module enable virt:kvm_utils2 -y
  4. Perform any necessary package upgrade or downgrade operations to handle dependencies for the enabled module and stream:

    sudo dnf --allowerasing distro-sync
  5. Install the base packages from the virt:kvm_utils2 stream:

    sudo dnf module install virt:kvm_utils2 -y

Caution:

Pre-existing guests that were created by using the default KVM stack might not be compatible and might not start using the Oracle KVM stack.

Note that although you can switch to the Oracle KVM stack and install the packages while using RHCK, the stack isn't compatible. You must be running a current version of UEK to use this software.

Switching to the Default KVM Stack

On an existing Oracle Linux 8 system, you can switch from the Oracle KVM stack to the default KVM stack by performing the following steps:

  1. Remove any packages from the existing Oracle virt:kvm_utils or virt:kvm_utils2 streams:

    sudo dnf module remove virt:kvm_utils -y --all
    sudo dnf module remove virt:kvm_utils2 -y --all
  2. Reset the virt module state so that it's neither enabled nor disabled:

    sudo dnf module reset virt -y
  3. Enable the virt module and stream:

    sudo dnf module enable virt -y
  4. Perform any necessary package upgrade or downgrade operations to handle dependencies for the enabled module and stream:

    sudo dnf --allowerasing distro-sync
  5. Install the base packages from the virt stream:

    sudo dnf module install virt -y

Caution:

Pre-existing guests that were created by using the Oracle KVM stack aren't compatible and might not start using the default KVM stack.

Validating the Host System

The libvirt package provides a validation utility that checks whether a system can function correctly as a virtualization host. The utility can check for several virtualization functionalities, but KVM functionality is covered by testing the qemu virtualization type.

To test whether a system can act as a KVM host, run the following command:

sudo virt-host-validate qemu

If all checks return a PASS value, the system can host guest VMs. If any of the tests fail, a reason is provided and information is displayed on how to resolve the issue, if such an option is available.

Note:

If the following message is displayed, the system isn't capable of functioning as a KVM host:

QEMU: Checking for hardware virtualization: FAIL (Only emulated CPUs are
      available, performance will be significantly limited)

If you try to create or start a VM on a host where this message is displayed, the action is likely to fail.