1
00:00:00,000 --> 00:00:12,120
In this video, I'll tell you how to manage and install KVM virtual machines.

2
00:00:12,120 --> 00:00:17,760
So it all comes down to this demo, but first you need to find out if your CPU has virtualization

3
00:00:17,760 --> 00:00:19,160
support.

4
00:00:19,160 --> 00:00:27,959
You can do that by grabbing for the VMX feature, or if you're on an AMD CPU, use SVM.

5
00:00:27,959 --> 00:00:31,840
Next you use dnf groups install virtualization host.

6
00:00:31,840 --> 00:00:38,599
That will, on CentOS and related, give all the software to allow you to run a virtualization

7
00:00:38,599 --> 00:00:39,599
platform.

8
00:00:39,599 --> 00:00:45,919
Next, use dnf install virtmanager to install the graphical virtual manager tool, and then

9
00:00:45,919 --> 00:00:49,919
clone the ISO file of the operating system that you want to use.

10
00:00:49,919 --> 00:00:57,599
For instance, dd ifsdev sr0 ofsrel9.iso will give you an ISO file based on the installation

11
00:00:57,639 --> 00:00:58,639
disk.

12
00:00:58,639 --> 00:01:04,440
Then in systemd you need to enable libvirtd, because libvirtd is a vital component for

13
00:01:04,440 --> 00:01:05,440
virtualization.

14
00:01:05,440 --> 00:01:12,000
It's the generic interface that any utility like the graphical virtmanager or the command-line

15
00:01:12,000 --> 00:01:16,599
based vers for virtual shell utility are going to use.

16
00:01:16,599 --> 00:01:22,320
Next, use virtmanager to start the graphical based virtual manager.

17
00:01:22,320 --> 00:01:27,559
For this demo, I'm on CentOS 9 for the simple reason that one of the most essential required

18
00:01:28,519 --> 00:01:35,120
packages, the virtual machine manager, is no longer in the repositories on CentOS 10.

19
00:01:35,120 --> 00:01:36,120
So let me show you.

20
00:01:36,120 --> 00:01:43,599
First, I'm going to use grep vmx on slash proc slash cpuinfo.

21
00:01:43,599 --> 00:01:49,400
And there we can see that the vmx flag is available on all of my CPUs.

22
00:01:49,400 --> 00:01:52,599
And next, I also want to do a quick check on memory.

23
00:01:52,599 --> 00:01:56,360
As you can see, 8 gigs in total should be enough.

24
00:01:56,360 --> 00:02:03,279
And df minus 8 is showing a root volume where 42 gigs is available.

25
00:02:03,279 --> 00:02:08,679
And that is also largely enough to store the virtualization requirements.

26
00:02:08,679 --> 00:02:20,679
Next, I need to install some packages, dnf groups install virtualization host is going

27
00:02:20,679 --> 00:02:23,240
to do that for me.

28
00:02:23,240 --> 00:02:30,000
So it's a lot of packages, but you are going to need them as the base of the KVM virtualization

29
00:02:30,000 --> 00:02:31,000
platform.

30
00:02:31,000 --> 00:02:37,639
Okay, now that the base virtualization packages have been installed, we also need to install

31
00:02:37,639 --> 00:02:39,199
the virtmanager package.

32
00:02:39,199 --> 00:02:44,800
The virtmanager is a graphical application that is required for creating virtual machines

33
00:02:44,800 --> 00:02:46,559
in an easy way.

34
00:02:46,559 --> 00:02:51,320
You can also create virtual machines from the command line using virtinstall.

35
00:02:51,399 --> 00:02:53,600
Good, that's a little bit more complicated.

36
00:02:53,600 --> 00:02:55,440
So let's not do that.

37
00:02:55,440 --> 00:03:04,119
Now that I connected my optical disk, I can use lsblk and lsblk is showing SR0 is available.

38
00:03:04,119 --> 00:03:05,119
Good.

39
00:03:05,119 --> 00:03:16,839
So I can use dd if is slash dev slash SR0, of is slash centos 9.iso, bs is 1m.

40
00:03:16,839 --> 00:03:18,279
And that's going to clone it.

41
00:03:18,279 --> 00:03:22,440
And that might take a minute depending on the speed of your storage.

42
00:03:22,440 --> 00:03:26,199
You know what, I'm going to move this to a background job.

43
00:03:26,199 --> 00:03:29,399
No need to wait for this because there's more work to do.

44
00:03:29,399 --> 00:03:30,600
Oh, and there you go.

45
00:03:30,600 --> 00:03:31,600
It's done.

46
00:03:31,600 --> 00:03:32,600
Well, that's excellent.

47
00:03:32,600 --> 00:03:36,119
Now I need to make sure that we have libvirtd.

48
00:03:36,119 --> 00:03:42,080
So I'm using systemctl enable minus minus now on libvirtd.

49
00:03:42,080 --> 00:03:46,080
libvirtd is the generic virtualization interface.

50
00:03:46,080 --> 00:03:50,759
And it is used by all the virtualization utilities on Linux.

51
00:03:50,759 --> 00:03:58,080
So no matter if you use the graphical virtmanager, or if you use command line virtinstall, libvirtd

52
00:03:58,080 --> 00:04:00,639
must be running at all times.

53
00:04:00,639 --> 00:04:07,320
And now all should be ready and it's time to run the virtual machine manager.

54
00:04:07,320 --> 00:04:10,399
It's a graphical utility for a change.

55
00:04:10,399 --> 00:04:12,800
And it requires privileges.

56
00:04:12,800 --> 00:04:14,440
So let's do that.

57
00:04:14,440 --> 00:04:17,359
And now it's ready to go.

58
00:04:17,359 --> 00:04:22,839
So here we have the QEMU KVM system interface.

59
00:04:22,839 --> 00:04:26,600
And I need that to create my virtual machine.

60
00:04:26,600 --> 00:04:28,880
And in my virtual machine, I'm selecting what I want.

61
00:04:28,880 --> 00:04:32,679
I want to install from ISO image.

62
00:04:32,679 --> 00:04:36,679
Then I need to browse to select my media.

63
00:04:36,679 --> 00:04:41,519
This browser is a little bit awkward, but you need to click Browse Local.

64
00:04:41,519 --> 00:04:46,920
And when you browse local, you go to wherever you need to go.

65
00:04:46,920 --> 00:04:54,359
And that is not home, but that is the disk, as I created the ISO in the root of the file

66
00:04:54,359 --> 00:04:55,359
system.

67
00:04:55,359 --> 00:05:01,200
So this is detecting the operating system that it can find in the ISO file.

68
00:05:01,200 --> 00:05:02,880
That shouldn't take too long.

69
00:05:02,880 --> 00:05:08,559
And if you don't want to wait for it, feel free to unselect and to select the operating

70
00:05:08,559 --> 00:05:11,239
system yourself.

71
00:05:11,239 --> 00:05:15,519
So when I do RET, when I type RET, I can see RETTED.

72
00:05:15,519 --> 00:05:18,119
And I go for RETTED Enterprise Linux 9.

73
00:05:18,119 --> 00:05:23,000
This is just selecting a generic installation profile, so it's not extremely important.

74
00:05:23,000 --> 00:05:25,640
Next, you click Forward.

75
00:05:25,640 --> 00:05:28,760
You define the amount of RAM and the amount of CPUs.

76
00:05:28,760 --> 00:05:32,600
Well, given my current configuration, this should do it.

77
00:05:33,320 --> 00:05:34,799
Then you define the size of the disk.

78
00:05:34,799 --> 00:05:37,239
I make that a little bit smaller with 10 gigs.

79
00:05:37,239 --> 00:05:38,239
It's more than enough.

80
00:05:38,239 --> 00:05:43,440
Then you click Forward, and you can change the networking if you want to.

81
00:05:43,440 --> 00:05:44,440
I don't want to.

82
00:05:44,440 --> 00:05:46,059
I just want to click Finish.

83
00:05:46,059 --> 00:05:49,720
And I want LibVirt to take care of all of it.

84
00:05:49,720 --> 00:05:54,519
So after clicking Finish, the installation procedure of your virtual machine will start.

85
00:05:54,519 --> 00:05:58,440
And at the end, you will have a nice virtual machine that is up and running for you.

