Difference between revisions of "LinuxVirtualization"
(→KVM & QEMU - The "Built-In" Virtualization Tools Which are Built Into the Linux Kernel by Default!) |
|||
| (One intermediate revision by the same user not shown) | |||
| Line 45: | Line 45: | ||
KVM & QEMU are built into the Linux kernel, making it the most efficient method of virtualization on a Linux host machine! Usage of KVM & QEMU are for more advanced users, as unlike VirtualBox, which has a user-friendly Graphical User Interface(GUI), KVM & QEMU don't automatically come with a graphical interface, and instead is used from the command line, most of the time, to create and manage virtual machines. There are numerous add-on software tools available for free to make it easier to create and manage VM's using KVM & QEMU, most notably "Virt-Manager", which provides a nice graphical interface to the KVM & QEMU tools. These tools require advanced knowledge of Linux networking in order to create and manage "bridged networks" and "NAT'd Networking". | KVM & QEMU are built into the Linux kernel, making it the most efficient method of virtualization on a Linux host machine! Usage of KVM & QEMU are for more advanced users, as unlike VirtualBox, which has a user-friendly Graphical User Interface(GUI), KVM & QEMU don't automatically come with a graphical interface, and instead is used from the command line, most of the time, to create and manage virtual machines. There are numerous add-on software tools available for free to make it easier to create and manage VM's using KVM & QEMU, most notably "Virt-Manager", which provides a nice graphical interface to the KVM & QEMU tools. These tools require advanced knowledge of Linux networking in order to create and manage "bridged networks" and "NAT'd Networking". | ||
<br /><br /> | <br /><br /> | ||
| + | |||
| + | === '''Before installing virtualization software, or any software on any Linux distribution, it's best practice to first '''ALWAYS''' update the local cache of available software packages from the configured software repositories. In the case of Fedora Linux, here is an example of the command, using the current "DNF" software package management tools, instead of the previous old RPM tools we used to use on RPM packages.''' === | ||
| + | <pre style="color:blue"> | ||
| + | [jamie@server.dawgland.com:~]$ sudo dnf check-update --refresh | ||
| + | Copr repo for PyCharm owned by phracek 3.0 kB/s | 2.1 kB 00:00 | ||
| + | Fedora 40 - x86_64 57 kB/s | 29 kB 00:00 | ||
| + | Fedora 40 openh264 (From Cisco) - x86_64 3.3 kB/s | 989 B 00:00 | ||
| + | Fedora 40 - x86_64 - Updates 81 kB/s | 28 kB 00:00 | ||
| + | google-chrome 4.8 kB/s | 1.3 kB 00:00 | ||
| + | RPM Fusion for Fedora 40 - Nonfree - NVIDIA Dri 9.1 kB/s | 6.6 kB 00:00 | ||
| + | RPM Fusion for Fedora 40 - Nonfree - Steam 12 kB/s | 6.4 kB 00:00 | ||
| + | |||
| + | ImageMagick.x86_64 1:7.1.1.47-1.fc40 updates | ||
| + | ImageMagick-libs.x86_64 1:7.1.1.47-1.fc40 updates | ||
| + | LibRaw.x86_64 0.21.4-1.fc40 updates | ||
| + | NetworkManager.x86_64 1:1.46.6-1.fc40 updates | ||
| + | |||
| + | . | ||
| + | . | ||
| + | . | ||
| + | </pre> | ||
| + | <br /><br /> | ||
| + | |||
The easiest way to install all of the required software tools, including the optional ones, which I recommend, is a one-liner command line command, as shown here: | The easiest way to install all of the required software tools, including the optional ones, which I recommend, is a one-liner command line command, as shown here: | ||
<pre style="color:blue"> | <pre style="color:blue"> | ||
| Line 51: | Line 74: | ||
<br /><br /> | <br /><br /> | ||
| − | Often times, some of the virtualization software tools are already installed by default on your system, which the above command will find and not re-install if already installed. In my case, some of the tools were installed, but many were not, as seen in this scroll-back of my most recent installation of the entire virtualization tools package. | + | Often times, some of the virtualization software tools are already installed by default on your system, which the above command will find and not re-install if already installed. In my case, in which I was already starting with a new fresh installation of Fedora Linux 42 Desktop edition on my new Dell Laptop, some of the tools were installed, but many were not, as seen in this scroll-back of my most recent installation of the entire virtualization tools package. |
<pre style="color:blue"> | <pre style="color:blue"> | ||
jamie@dell16fc42:~$ sudo dnf group install --with-optional virtualization | jamie@dell16fc42:~$ sudo dnf group install --with-optional virtualization | ||
Latest revision as of 21:22, 15 August 2025
Linux Virtualization - Using Linux to Host Other Operating Systems on Top of Linux!
Linux is such a powerful operating system that is already has virtualization built into the Linux Kernel! This makes setting up virtualization on a Linux machine very simple, and easy to setup. Even the commercial virtualization softare often is based on the Linux Kernel, even VMware ESXi and vSphere is based on a heavily modified Linux kernel.
VirtualBox - Oracle's Totally FREE Virtualization Software Tools
There are many options when using Linux to host virtual machines. For beginners, I find that the easiest route is by using the FREE virtualization software tools by Oracle, called VirtualBox. I LOVE VirtualBox, and used it for many years to quickly and easily create virtual macines, not only an a Linux host, but also on Windows and MAC host machines! And yes, it's TOTALLY FREE for all versionks of VirtualBox. I have created hundreds of custom shell command-line scripts over the years to manage over 100 virtusla machines running on top of VirtualBox
Here's an example of a very basic, simple shell script that starts up a Linux VM(Virtual Machine) from the command line, in headless mode:
#!/usr/bin/bash # Jamie - 10-03-2020 # FreeIPA_Server1-startvm - Start FreeIPA Server #1 on CentOS 8 in Headless mode # Now starts the RockyLinux I now have from migrating the original CentOS 8 echo "" vboxheadless --startvm FreeIPA_Server-1 & echo "Please stand by while the VM starts up..." sleep 20 echo "" echo "The FreeIPA Server takes a LONG time to start up..." echo "" echo "Please be patient and stand by..." echo "" sleep 90 echo "" echo "Almost there..." echo "" sleep 20 echo "" echo "The FreeIPA Server VM is now running!" echo ""
This, like all shell scripts, must have executable permissions in order to run from the command-line. The easiest way to ensure and/or change the permissions of the script file is to use the chmod command, like this:
[jamie@server.dawgland.com:~$ sudo chmod 755 ansctrl8-StartVM [jamie@server.dawgland.com:~$
KVM & QEMU - The "Built-In" Virtualization Tools Which are Built Into the Linux Kernel by Default!
KVM & QEMU are built into the Linux kernel, making it the most efficient method of virtualization on a Linux host machine! Usage of KVM & QEMU are for more advanced users, as unlike VirtualBox, which has a user-friendly Graphical User Interface(GUI), KVM & QEMU don't automatically come with a graphical interface, and instead is used from the command line, most of the time, to create and manage virtual machines. There are numerous add-on software tools available for free to make it easier to create and manage VM's using KVM & QEMU, most notably "Virt-Manager", which provides a nice graphical interface to the KVM & QEMU tools. These tools require advanced knowledge of Linux networking in order to create and manage "bridged networks" and "NAT'd Networking".
Before installing virtualization software, or any software on any Linux distribution, it's best practice to first ALWAYS update the local cache of available software packages from the configured software repositories. In the case of Fedora Linux, here is an example of the command, using the current "DNF" software package management tools, instead of the previous old RPM tools we used to use on RPM packages.
[jamie@server.dawgland.com:~]$ sudo dnf check-update --refresh Copr repo for PyCharm owned by phracek 3.0 kB/s | 2.1 kB 00:00 Fedora 40 - x86_64 57 kB/s | 29 kB 00:00 Fedora 40 openh264 (From Cisco) - x86_64 3.3 kB/s | 989 B 00:00 Fedora 40 - x86_64 - Updates 81 kB/s | 28 kB 00:00 google-chrome 4.8 kB/s | 1.3 kB 00:00 RPM Fusion for Fedora 40 - Nonfree - NVIDIA Dri 9.1 kB/s | 6.6 kB 00:00 RPM Fusion for Fedora 40 - Nonfree - Steam 12 kB/s | 6.4 kB 00:00 ImageMagick.x86_64 1:7.1.1.47-1.fc40 updates ImageMagick-libs.x86_64 1:7.1.1.47-1.fc40 updates LibRaw.x86_64 0.21.4-1.fc40 updates NetworkManager.x86_64 1:1.46.6-1.fc40 updates . . .
The easiest way to install all of the required software tools, including the optional ones, which I recommend, is a one-liner command line command, as shown here:
jamie@dell16fc42:~$ sudo dnf group install --with-optional virtualization
Often times, some of the virtualization software tools are already installed by default on your system, which the above command will find and not re-install if already installed. In my case, in which I was already starting with a new fresh installation of Fedora Linux 42 Desktop edition on my new Dell Laptop, some of the tools were installed, but many were not, as seen in this scroll-back of my most recent installation of the entire virtualization tools package.
jamie@dell16fc42:~$ sudo dnf group install --with-optional virtualization Updating and loading repositories: Repositories loaded. Package "libvirt-daemon-config-network-11.0.0-2.fc42.x86_64" is already installed. Package "libvirt-daemon-kvm-11.0.0-2.fc42.x86_64" is already installed. Package "qemu-kvm-2:9.2.3-1.fc42.x86_64" is already installed. Package Arch Version Repository Size Installing group/module packages: guestfs-tools x86_64 1.53.9-1.fc42 updates 31.8 MiB python3-libguestfs x86_64 1:1.55.7-1.fc42 fedora 1.3 MiB virt-install noarch 5.0.0-2.fc42 fedora 34.7 KiB virt-manager noarch 5.0.0-2.fc42 fedora 3.5 MiB virt-top x86_64 1.1.2-1.fc42 fedora 3.6 MiB virt-viewer x86_64 11.0-15.fc42 fedora 1.2 MiB Installing dependencies: dhcpcd x86_64 10.1.0-2.fc42 fedora 492.1 KiB hexedit x86_64 1.6-8.fc42 fedora 77.9 KiB hivex-libs x86_64 1.3.24-3.fc42 fedora 87.3 KiB libburn x86_64 1.5.6-6.fc42 fedora 357.5 KiB libconfig x86_64 1.7.3-11.fc42 fedora 225.4 KiB libguestfs x86_64 1:1.55.7-1.fc42 fedora 3.8 MiB libguestfs-appliance x86_64 1:1.55.7-1.fc42 fedora 2.5 MiB libisoburn x86_64 1.5.6-7.fc42 fedora 1.1 MiB libisofs x86_64 1.5.6-6.fc42 fedora 508.3 KiB libldm x86_64 0.2.4-16.fc41 fedora 140.7 KiB lsscsi x86_64 0.32-13.fc42 fedora 124.8 KiB python3-libxml2 x86_64 2.12.10-1.fc42 fedora 1.2 MiB supermin x86_64 5.3.5-4.fc42 fedora 2.1 MiB syslinux x86_64 6.04-0.30.fc42 fedora 1.0 MiB syslinux-extlinux x86_64 6.04-0.30.fc42 fedora 206.1 KiB syslinux-extlinux-nonlinux noarch 6.04-0.30.fc42 fedora 976.7 KiB syslinux-nonlinux noarch 6.04-0.30.fc42 fedora 1.8 MiB virt-manager-common noarch 5.0.0-2.fc42 fedora 6.2 MiB xorriso x86_64 1.5.6-7.fc42 fedora 341.6 KiB zerofree x86_64 1.1.1-15.fc42 fedora 49.9 KiB Installing weak dependencies: libguestfs-xfs x86_64 1:1.55.7-1.fc42 fedora 9.0 B Installing groups: Virtualization Transaction Summary: Installing: 27 packages Total size of inbound packages is 16 MiB. Need to download 16 MiB. After this operation, 65 MiB extra will be used (install 65 MiB, remove 0 B). Is this ok [y/N]: y [ 1/27] virt-install-0:5.0.0-2.fc42.noarch 100% | 66.6 KiB/s | 41.3 KiB | 00m01s [ 2/27] virt-viewer-0:11.0-15.fc42.x86_64 100% | 269.5 KiB/s | 302.1 KiB | 00m01s [ 3/27] python3-libguestfs-1:1.55.7-1.fc42.x86_64 100% | 474.3 KiB/s | 238.1 KiB | 00m01s [ 4/27] virt-manager-0:5.0.0-2.fc42.noarch 100% | 426.6 KiB/s | 709.4 KiB | 00m02s [ 5/27] virt-top-0:1.1.2-1.fc42.x86_64 100% | 669.1 KiB/s | 1.1 MiB | 00m02s [ 6/27] virt-manager-common-0:5.0.0-2.fc42.noarch 100% | 654.3 KiB/s | 1.2 MiB | 00m02s [ 7/27] python3-libxml2-0:2.12.10-1.fc42.x86_64 100% | 492.8 KiB/s | 224.7 KiB | 00m00s [ 8/27] hexedit-0:1.6-8.fc42.x86_64 100% | 442.9 KiB/s | 42.5 KiB | 00m00s [ 9/27] hivex-libs-0:1.3.24-3.fc42.x86_64 100% | 360.1 KiB/s | 42.8 KiB | 00m00s [10/27] libguestfs-1:1.55.7-1.fc42.x86_64 100% | 631.4 KiB/s | 1.1 MiB | 00m02s [11/27] libconfig-0:1.7.3-11.fc42.x86_64 100% | 344.8 KiB/s | 71.7 KiB | 00m00s [12/27] xorriso-0:1.5.6-7.fc42.x86_64 100% | 574.5 KiB/s | 321.7 KiB | 00m01s [13/27] dhcpcd-0:10.1.0-2.fc42.x86_64 100% | 659.3 KiB/s | 236.0 KiB | 00m00s [14/27] lsscsi-0:0.32-13.fc42.x86_64 100% | 720.8 KiB/s | 65.6 KiB | 00m00s [15/27] libisoburn-0:1.5.6-7.fc42.x86_64 100% | 684.8 KiB/s | 429.3 KiB | 00m01s [16/27] supermin-0:5.3.5-4.fc42.x86_64 100% | 733.9 KiB/s | 702.3 KiB | 00m01s [17/27] syslinux-0:6.04-0.30.fc42.x86_64 100% | 663.6 KiB/s | 568.0 KiB | 00m01s [18/27] zerofree-0:1.1.1-15.fc42.x86_64 100% | 298.0 KiB/s | 27.7 KiB | 00m00s [19/27] syslinux-extlinux-0:6.04-0.30.fc42.x86_64 100% | 768.0 KiB/s | 131.3 KiB | 00m00s [20/27] libburn-0:1.5.6-6.fc42.x86_64 100% | 661.1 KiB/s | 170.6 KiB | 00m00s [21/27] libisofs-0:1.5.6-6.fc42.x86_64 100% | 641.7 KiB/s | 234.9 KiB | 00m00s [22/27] syslinux-extlinux-nonlinux-0:6.04-0.30.fc42 100% | 732.6 KiB/s | 394.2 KiB | 00m01s [23/27] syslinux-nonlinux-0:6.04-0.30.fc42.noarch 100% | 686.0 KiB/s | 597.5 KiB | 00m01s [24/27] libldm-0:0.2.4-16.fc41.x86_64 100% | 478.7 KiB/s | 56.0 KiB | 00m00s [25/27] libguestfs-xfs-1:1.55.7-1.fc42.x86_64 100% | 127.7 KiB/s | 14.4 KiB | 00m00s [26/27] libguestfs-appliance-1:1.55.7-1.fc42.x86_64 100% | 759.8 KiB/s | 2.5 MiB | 00m03s [27/27] guestfs-tools-0:1.53.9-1.fc42.x86_64 100% | 5.4 MiB/s | 4.5 MiB | 00m01s -------------------------------------------------------------------------------------------- [27/27] Total 100% | 1.9 MiB/s | 15.9 MiB | 00m08s Running transaction [ 1/29] Verify package files 100% | 341.0 B/s | 27.0 B | 00m00s [ 2/29] Prepare transaction 100% | 54.0 B/s | 27.0 B | 00m00s [ 3/29] Installing syslinux-nonlinux-0:6.04-0.30.fc 100% | 81.4 MiB/s | 1.8 MiB | 00m00s [ 4/29] Installing syslinux-0:6.04-0.30.fc42.x86_64 100% | 32.7 MiB/s | 1.0 MiB | 00m00s [ 5/29] Installing hivex-libs-0:1.3.24-3.fc42.x86_6 100% | 21.7 MiB/s | 88.7 KiB | 00m00s [ 6/29] Installing syslinux-extlinux-nonlinux-0:6.0 100% | 96.2 MiB/s | 985.2 KiB | 00m00s [ 7/29] Installing syslinux-extlinux-0:6.04-0.30.fc 100% | 7.2 MiB/s | 207.0 KiB | 00m00s [ 8/29] Installing libldm-0:0.2.4-16.fc41.x86_64 100% | 4.1 MiB/s | 142.5 KiB | 00m00s [ 9/29] Installing libisofs-0:1.5.6-6.fc42.x86_64 100% | 71.2 MiB/s | 510.0 KiB | 00m00s [10/29] Installing libburn-0:1.5.6-6.fc42.x86_64 100% | 70.1 MiB/s | 359.1 KiB | 00m00s [11/29] Installing libisoburn-0:1.5.6-7.fc42.x86_64 100% | 108.4 MiB/s | 1.1 MiB | 00m00s [12/29] Installing xorriso-0:1.5.6-7.fc42.x86_64 100% | 6.9 MiB/s | 344.3 KiB | 00m00s [13/29] Installing zerofree-0:1.1.1-15.fc42.x86_64 100% | 1.7 MiB/s | 51.7 KiB | 00m00s [14/29] Installing supermin-0:5.3.5-4.fc42.x86_64 100% | 61.4 MiB/s | 2.1 MiB | 00m00s [15/29] Installing lsscsi-0:0.32-13.fc42.x86_64 100% | 1.4 MiB/s | 126.6 KiB | 00m00s [16/29] Installing dhcpcd-0:10.1.0-2.fc42.x86_64 100% | 6.6 MiB/s | 496.4 KiB | 00m00s [17/29] Installing libguestfs-appliance-1:1.55.7-1. 100% | 204.6 MiB/s | 2.5 MiB | 00m00s [18/29] Installing libconfig-0:1.7.3-11.fc42.x86_64 100% | 37.1 MiB/s | 227.6 KiB | 00m00s [19/29] Installing hexedit-0:1.6-8.fc42.x86_64 100% | 2.6 MiB/s | 79.3 KiB | 00m00s [20/29] Installing libguestfs-1:1.55.7-1.fc42.x86_6 100% | 63.6 MiB/s | 3.8 MiB | 00m00s [21/29] Installing python3-libxml2-0:2.12.10-1.fc42 100% | 133.4 MiB/s | 1.2 MiB | 00m00s [22/29] Installing virt-manager-common-0:5.0.0-2.fc 100% | 88.7 MiB/s | 6.3 MiB | 00m00s [23/29] Installing virt-install-0:5.0.0-2.fc42.noar 100% | 1.6 MiB/s | 36.1 KiB | 00m00s [24/29] Installing virt-manager-0:5.0.0-2.fc42.noar 100% | 63.5 MiB/s | 3.6 MiB | 00m00s [25/29] Installing python3-libguestfs-1:1.55.7-1.fc 100% | 98.6 MiB/s | 1.3 MiB | 00m00s [26/29] Installing guestfs-tools-0:1.53.9-1.fc42.x8 100% | 241.2 MiB/s | 31.8 MiB | 00m00s [27/29] Installing libguestfs-xfs-1:1.55.7-1.fc42.x 100% | 144.5 KiB/s | 296.0 B | 00m00s [28/29] Installing virt-top-0:1.1.2-1.fc42.x86_64 100% | 91.0 MiB/s | 3.6 MiB | 00m00s [29/29] Installing virt-viewer-0:11.0-15.fc42.x86_6 100% | 424.4 KiB/s | 1.2 MiB | 00m03s Complete! jamie@dell16fc42:~$