In this video, I'll tell you how to manage and install KVM virtual machines.
So it all comes down to this demo, but first you need to find out if your CPU has virtualization
support.
You can do that by grabbing for the VMX feature, or if you're on an AMD CPU, use SVM.
Next you use DNF Group's install virtualization host.
That will, on CentOS and related, give all the software to allow you to run a virtualization
platform.
Next, use DNF install virtmanager to install the graphical virtual manager tool, and then
clone the ISO file of the operating system that you want to use.
For instance, dd ifsdev sr0 ofsrel9.iso will give you an ISO file based on the installation
disk.
Then in systemd you need to enable libvirtd, because libvirtd is a vital component for
virtualization.
It's the generic interface that any utility like the graphical virtmanager or the command-line
based vers for virtual shell utility are going to use.
Next, use virtmanager to start the graphical based virtual manager.
For this demo, I'm on CentOS 9 for the simple reason that one of the most essential required
packages, the virtual machine manager, is no longer in the repositories on CentOS 10.
So let me show you.
First, I'm going to use grep vmx on slash proc slash cpuinfo.
And there we can see that the vmx flag is available on all of my CPUs.
And next, I also want to do a quick check on memory.
As you can see, 8 gigs in total should be enough.
And df minus 8 is showing a root volume where 42 gigs is available.
And that is also largely enough to store the virtualization requirements.
Next, I need to install some packages, dnf groups install virtualization host is going
to do that for me.
So it's a lot of packages, but you are going to need them as the base of the KVM virtualization
platform.
Okay, now that the base virtualization packages have been installed, we also need to install
the virtmanager package.
The virtmanager is a graphical application that is required for creating virtual machines
in an easy way.
You can also create virtual machines from the command line using virtinstall.
Good, that's a little bit more complicated, so let's not do that.
Now that I connected my optical disk, I can use lsblk, and lsblk is showing SR0 is available.
Good.
So I can use dd if is slash dev slash SR0, of is slash centos 9.iso, bs is 1m, and that's
going to clone it, and that might take a minute, depending on the speed of your storage.
You know what?
I'm going to move this to a background job.
No need to wait for this, because there's more work to do.
Oh, and there you go, it's done.
Well, that's excellent.
Now I need to make sure that we have libvirtd.
So I'm using systemctl enable minus minus now on libvirtd.
Libvirtd is the generic virtualization interface, and it is used by all the virtualization utilities
on Linux.
So no matter if you use the graphical virtmanager, or if you use command line virtinstall, libvirtd
must be running at all times.
And now all should be ready, and it's time to run the virtual machine manager.
It's a graphical utility for a change, and it requires privileges.
So let's do that, and now it's ready to go.
So here we have the QEMU KVM system interface, and I need that to create my virtual machine.
And in my virtual machine, I'm selecting what I want.
I want to install from ISO image.
Then I need to browse to select my media.
This browser is a little bit awkward, but you need to click Browse Local.
And when you browse local, you go to wherever you need to go.
And that is not home, but that is the disk, as I created the ISO in the root of the file
system.
So this is detecting the operating system that it can find in the ISO file.
That shouldn't take too long.
And if you don't want to wait for it, feel free to unselect and to select the operating
system yourself.
So when I type red, I can see Red Hat, and I go for Red Hat Enterprise Linux 9.
This is just selecting a generic installation profile, so it's not extremely important.
Next you click Forward.
You define the amount of RAM and the amount of CPUs.
Well, given my current configuration, this should do it.
Then you define the size of the disk.
I make that a little bit smaller with 10 gigs.
It's more than enough.
Then you click Forward, and you can change the networking if you want to.
I don't want to.
I just want to click Finish, and I want LibVirt to take care of all of it.
So after clicking Finish, the installation procedure of your virtual machine will start,
and at the end, you will have a nice virtual machine that is up and running for you.