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 Group's 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,879 And next, I also want to do a quick check on memory. 23 00:01:52,879 --> 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,880 The virtmanager is a graphical application that is required for creating virtual machines 33 00:02:44,880 --> 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:55,440 Good, that's a little bit more complicated, so let's not do that. 36 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. 37 00:03:04,119 --> 00:03:05,119 Good. 38 00:03:05,119 --> 00:03:17,000 So I can use dd if is slash dev slash SR0, of is slash centos 9.iso, bs is 1m, and that's 39 00:03:17,000 --> 00:03:22,440 going to clone it, and that might take a minute, depending on the speed of your storage. 40 00:03:22,440 --> 00:03:23,440 You know what? 41 00:03:23,440 --> 00:03:26,199 I'm going to move this to a background job. 42 00:03:26,199 --> 00:03:29,520 No need to wait for this, because there's more work to do. 43 00:03:29,520 --> 00:03:31,080 Oh, and there you go, it's done. 44 00:03:31,080 --> 00:03:32,460 Well, that's excellent. 45 00:03:32,460 --> 00:03:36,119 Now I need to make sure that we have libvirtd. 46 00:03:36,119 --> 00:03:41,080 So I'm using systemctl enable minus minus now on libvirtd. 47 00:03:41,520 --> 00:03:49,399 Libvirtd is the generic virtualization interface, and it is used by all the virtualization utilities 48 00:03:49,399 --> 00:03:50,759 on Linux. 49 00:03:50,759 --> 00:03:58,039 So no matter if you use the graphical virtmanager, or if you use command line virtinstall, libvirtd 50 00:03:58,039 --> 00:04:00,679 must be running at all times. 51 00:04:00,679 --> 00:04:07,360 And now all should be ready, and it's time to run the virtual machine manager. 52 00:04:07,360 --> 00:04:12,800 It's a graphical utility for a change, and it requires privileges. 53 00:04:12,800 --> 00:04:17,359 So let's do that, and now it's ready to go. 54 00:04:17,359 --> 00:04:26,600 So here we have the QEMU KVM system interface, and I need that to create my virtual machine. 55 00:04:26,600 --> 00:04:28,880 And in my virtual machine, I'm selecting what I want. 56 00:04:28,880 --> 00:04:32,679 I want to install from ISO image. 57 00:04:32,679 --> 00:04:36,679 Then I need to browse to select my media. 58 00:04:36,679 --> 00:04:41,519 This browser is a little bit awkward, but you need to click Browse Local. 59 00:04:41,519 --> 00:04:46,920 And when you browse local, you go to wherever you need to go. 60 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 61 00:04:54,359 --> 00:04:55,359 system. 62 00:04:55,359 --> 00:05:01,200 So this is detecting the operating system that it can find in the ISO file. 63 00:05:01,200 --> 00:05:02,880 That shouldn't take too long. 64 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 65 00:05:08,559 --> 00:05:11,239 system yourself. 66 00:05:11,239 --> 00:05:18,119 So when I type red, I can see Red Hat, and I go for Red Hat Enterprise Linux 9. 67 00:05:18,119 --> 00:05:23,679 This is just selecting a generic installation profile, so it's not extremely important. 68 00:05:23,679 --> 00:05:25,640 Next you click Forward. 69 00:05:25,640 --> 00:05:28,760 You define the amount of RAM and the amount of CPUs. 70 00:05:28,760 --> 00:05:32,600 Well, given my current configuration, this should do it. 71 00:05:33,320 --> 00:05:34,799 Then you define the size of the disk. 72 00:05:34,799 --> 00:05:37,239 I make that a little bit smaller with 10 gigs. 73 00:05:37,239 --> 00:05:38,239 It's more than enough. 74 00:05:38,239 --> 00:05:43,440 Then you click Forward, and you can change the networking if you want to. 75 00:05:43,440 --> 00:05:44,440 I don't want to. 76 00:05:44,440 --> 00:05:49,720 I just want to click Finish, and I want LibVirt to take care of all of it. 77 00:05:49,720 --> 00:05:54,519 So after clicking Finish, the installation procedure of your virtual machine will start, 78 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.