Note: This is an RHCSA 7 exam objective.
Prerequisites
Download the CentOS 7 distribution (see Software requirements) and install it with default configuration.
Choose a domain name (example.com strongly recommended), a host name (for example master.example.com) and an IP address compatible with your network environment (here 192.168.1.5, gateway is supposed to be 192.168.1.1).
Update your system:
# yum update
Installation Procedure
Install the KVM packages:
# yum group install "Virtualization Host" # yum install -y virt-install virt-top libguestfs-tools
Note: The libguestfs-tools brings the very useful virt-sparsify command with it. When space is sparse, this command is invaluable: it limits the virtual machine footprint to the space used only.
Start the libvirtd service:
# systemctl start libvirtd
Activate the Chronyd/NTP service at boot and start it:
# systemctl enable chronyd && systemctl start chronyd
Check the installation:
# virt-host-validate QEMU: Checking for hardware virtualization : PASS QEMU: Checking for device /dev/kvm : PASS QEMU: Checking for device /dev/vhost-net : PASS QEMU: Checking for device /dev/net/tun : PASS LXC: Checking for Linux >= 2.6.26 : PASS
To get optimal performances, activate the virtual-host tuned profile:
# tuned-adm profile virtual-host
KVM Tip
You have just installed a KVM host but this installation will only last for 1 year. After this period and a reboot, your KVM certificate will expire. Look at this tutorial about KVM certificate expiration to set up an installation for more than 1 year.
KVM Updates
If you need a more recent version of QEMU/KVM (Nvidia GPU driver, etc), you can do it through a dedicated repository.
Install the EPEL repository:
# yum -y install epel-release
Install the CentOS-QEMU-EV repository:
# yum -y install centos-release-qemu-ev
Install the qemu-kvm-ev package:
# yum -y install qemu-kvm-ev
Restart the libvirtd daemon:
# systemctl restart libvirtd
Check the QEMU/KVM version:
# /usr/libexec/qemu-kvm -version QEMU emulator version 2.12.0 (qemu-kvm-ev-2.12.0-18.el7_6.1.1) Copyright (c) 2003-2017 Fabrice Bellard and the QEMU Project developers
Display the various supported models:
# /usr/libexec/qemu-kvm -machine help Supported machines are: pc RHEL 7.6.0 PC (i440FX + PIIX, 1996) (alias of pc-i440fx-rhel7.6.0) pc-i440fx-rhel7.6.0 RHEL 7.6.0 PC (i440FX + PIIX, 1996) (default) pc-i440fx-rhel7.5.0 RHEL 7.5.0 PC (i440FX + PIIX, 1996) pc-i440fx-rhel7.4.0 RHEL 7.4.0 PC (i440FX + PIIX, 1996) pc-i440fx-rhel7.3.0 RHEL 7.3.0 PC (i440FX + PIIX, 1996) pc-i440fx-rhel7.2.0 RHEL 7.2.0 PC (i440FX + PIIX, 1996) pc-i440fx-rhel7.1.0 RHEL 7.1.0 PC (i440FX + PIIX, 1996) pc-i440fx-rhel7.0.0 RHEL 7.0.0 PC (i440FX + PIIX, 1996) rhel6.6.0 RHEL 6.6.0 PC rhel6.5.0 RHEL 6.5.0 PC rhel6.4.0 RHEL 6.4.0 PC rhel6.3.0 RHEL 6.3.0 PC rhel6.2.0 RHEL 6.2.0 PC rhel6.1.0 RHEL 6.1.0 PC rhel6.0.0 RHEL 6.0.0 PC q35 RHEL-7.6.0 PC (Q35 + ICH9, 2009) (alias of pc-q35-rhel7.6.0) pc-q35-rhel7.6.0 RHEL-7.6.0 PC (Q35 + ICH9, 2009) pc-q35-rhel7.5.0 RHEL-7.5.0 PC (Q35 + ICH9, 2009) pc-q35-rhel7.4.0 RHEL-7.4.0 PC (Q35 + ICH9, 2009) pc-q35-rhel7.3.0 RHEL-7.3.0 PC (Q35 + ICH9, 2009) none empty machine
Source: www.server-world.info.
Additional Resources
You can get this QEMU error message: “qemu-kvm: Failed to create chardev”. In this case, follow the solution here.
Q 1) Do we have to perform all of our exam questions on KVM?
I am currently using vmware workstation to practice RHEL7.
Q 2) Is this all we need to do in exam regarding KVM? Or we have to do more than just installing KVM?
Q1) There is no mandatory requirements regarding KVM, you can use something else.
Q2) You are supposed to know how to install a VM inside a KVM environment. Practically, no task about installing a VM in this context never happened, it would take too much time.
When I run this command, on my fedora 25
# yum group install “Virtualization Host”
I got these errors,
Warning: Group ‘Virtualization Host’ does not exist.
Error: Nothing to do.
What should I do now? Is these commands only for CentOS, But all the commands run successfuly except above mentioned one.
On Fedora, the yum command has been replaced with dnf.
Try dnf group install “Virtualization Host”