How To Use Virtual Machines on Linux

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
virtual machines are pretty cool you can try out operating systems without a worry in the world that you might mess up your own installation you can use programs that are not Linux or why compatible and to a certain extent even play games on top of that virtualization offers another huge security layer because if your VM gets infected with a virus then you are still fine and maybe you can even restore it with a snapshot and the best part is that you can basically do it on any Linux operating system with a few side modes of course but before we get into virtualization on Linux I quickly want to remind you that you don't forget to give this video a like and while you're at it why not also subscribe to the channel thanks okay so before we get into virtualization on Linux I believe it would be best if we start off with virtualization in general so let's start talking about something that literally any VM needs in order to run properly a hypervisor but what even is that since your computer only has a limited amount of CPU cores RAM and storage a hypervisor is a small program that distributes those resources as efficiently as possible now there are two different types of hypervisors there are type 1 or also called bare metal hypervisors like VMware and hyper-v which run right on top of your hardware and distribute its resources to its so-called guests and then there are type 2 hypervisors like virtualbox and qemu which run on top of the so-called host operating system type 2 hypervisors are by Design slower than type 1 hypervisors because not only is the operating system handling the distribution of resources but the guest is also slowed down by the host if a lot of processes are running they are also considered less stable because of that because if the host crashes then so are the guests in reality though and especially for non-productive environments like ours the difference is really neglectable alright so let's talk about virtualization on Linux because it is a bit special nowadays if you already searched the internet for how to do it then you often come across two terms qemu and KVM since many programs often combine these two it often gets confusing what the actual difference is quick emulator or qemu is an emulator like virtualbox that runs on top of your operating system AKA it's a type 2 hypervisor qemu handles everything from creating virtual drives to install your operating system on turning virtual machines on and off it also integrates your peripherals like a mouse or keyboard via its own driver alright so what the heck is KVM then well KVM stands for kernel based virtual machine and it's part of the Linux kernel what KVM does is that it converts the kernel to a type 1 hypervisor which directly handles the hardware for virtual machines so why is qemu and KVM often used together if they are not even the same thing well that's because qemu can utilize KVM as a sort of Highway directly to the hardware and now it gets a bit confusing since if your host operating system is now a hypervisor and qemu would be running on top of that with all the processes going on here wouldn't qemu and KVM just be a type 2 hypervisor I mean a true like hack looks like it right truth is KVM is special and more like something in between because on a regular Linux installation with all of its programs and processes it is technically just an optimized way to pass through the hardware to Virtual machines it basically functions like Hardware acceleration and gpus except for virtual machines alright so we could still talk a lot more about virtual disks and abstraction layers but I think now would be the best time to just start virtualizing first things first if you want to get good performance or even use KVM at all then you need to make sure that your CPU actually supports virtualization you can do so by heading into the ufi go to the advanced CPU settings and look out for either Intel virtualization technology if you have an Intel CPU or for svm mode if you are on AMD some main board brands do often call these settings the same regardless of the actual Hardware behind it so watch out for that don't forget to save your changes and boot up your Linux distribution now first we'll cover a very basic and probably the most easiest way to virtualize and then we'll move on to a more advanced solution many of you and especially gnome users might already be familiar with gnome boxes which is essentially the most simplistic approach to Virtual machines that I have ever seen now I don't mean that condescending in any way since it literally is the easiest way that basically anyone can use a virtual machine it uses qemu and is also KVM compatible so it's fast and even supports three key acceleration so that your virtual machines perform well with a user interface in the top left corner you can either download an operating system from a provided list or you can choose your own ISO which you've downloaded from somewhere else prior you can give your virtual machine a name if supported by the iso choose ufi instead of BIOS and select how much RAM or disk space it is allowed to take up qemu does not Reserve this space but just grows dynamically to this maximum value if needed an error it already runs and we can begin with installation by the way if you notice that your mouse is stuck within the VM then with the hotkey alt and control you can free it again if you need to configure a device in Windows for example then you can pass it through in the preferences though remember that it will become unusable for your host until you pass it back again this is very important if you pass through a keyboard or a mouse because it just won't work on the host anymore you can also create snapshots if let's say you want to try something I'm gonna say special which you can always revert to and for most operating systems you are already done and you can start virtualize as much as you like and of course until your PC starts slowing down but there are a few things that boxes is really bad at for once some operating systems like Windows 11 which require a secure Boot and TPM 2.0 can't be installed straight away and also boxes chooses the amount of assigned use by itself so it can happen that it chooses all of your available cores which can have a negative impact if you have several VMS as well as your host operating system running another thing is that some VMS that don't get recognized that well don't have to 3D acceleration option now since boxes is based on qemu and KVM you can enable these settings however you can only do it by editing this XML configuration and boy you better know what you're doing here so for just virtualizing Windows 10 it lower as well as Mac OS and most Linux distributions boxes will do just fine now let's move on to something more advanced but also something that gives you way more control over the settings now there are many different solutions to choose from but I personally like to use Virtual Machine manager which is still open source it also features a nice user interface right from the start when creating a virtual machine in we already have a couple more options than before but unlike boxes we do need an ISO here since there is no default repository the first step then is to define the directory of your saved isos now we could create a store pool with a ton of options but these are more advanced settings we just want to set up a basic installation so instead just click on browse local and select your ISO in the ideal case virtual machine manager should already detect the operating system which basically serves as a sort of template for the configuration like minimum specs Etc if not you can just use a generic or closed system instead next we Define our maximum of ram the amount of CPU cores and create a virtual disk like in boxes this disk grows dynamically and doesn't take up the space right away finally we give our VM a name and we would be done already however if you're running an operating system like Windows 11 or a Linux distribution with a desktop environment I would recommend you to also select customized configuration before install because we still need to adjust some things for a battery smooth experience right off the start some operating systems like Windows 11 for example do require secure Boot and TPM 2.0 chip that means that if we don't want to deal with secure boot later we can already select this option as a sort of shortcut we also need to make sure the TPM chip is being set to version 2.0 if you're missing some options then you can add more Hardware right here this menu also allows you to pass through devices like your mouse or GPU which gets then picked up by the VM as a directly connected device instead of something virtual this is useful for configuring peripherals or gaming performance but do remember that the connected device won't work on the host anymore while the VM is running so don't pass your GPU through if you only have one one more thing that you should definitely configure on any virtual machine which features Graphics is 3D Hardware acceleration because otherwise you might experience stutters or missing animations the first thing that we want to do is to head over to display spies and take the opengl checkbox now it already tells us that something is still wrong with our configuration so let's fix that we want to set the listen Type To None and hit apply then we head over to video qxl change it to word IO and make sure it has a checkbox shows an actual check mark now one more thing that I should mention especially when installing Windows 11 is that for some reason the current Windows boot images only work if you go into the XML and replace the section that says hyper-v with the following configuration all the windows isos work fine though so I have no clue what Microsoft did or if this is a qemu issue because boxes doesn't have it but anyway that fixes it and now you can just go ahead and install as many virtual machines as you want or need so if you've liked this video then please make sure to show it with a like and definitely make sure that you are subscribed to the channel if you want to see more content like this right now you can just continue and watch another video and all that's left to say now is good morning good afternoon or good evening wherever you are I'll see you around thank you
Info
Channel: Michael Horn
Views: 10,492
Rating: undefined out of 5
Keywords: virtual machine, virtual box, virtual machine on linux, linux virtual machine, linux virtual machine windows 11, virtual machine windows 10, virtual machine windows 11, virtual machine linux, windows 10 virtual machine on linux, logitech g hub linux, virtual machine passthrough gpu, virtualization on linux, virtualization on linux server
Id: t-23HOKMer0
Channel Id: undefined
Length: 11min 36sec (696 seconds)
Published: Wed May 17 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.