summaryrefslogtreecommitdiff
path: root/kvm.html
diff options
context:
space:
mode:
Diffstat (limited to 'kvm.html')
-rw-r--r--kvm.html111
1 files changed, 111 insertions, 0 deletions
diff --git a/kvm.html b/kvm.html
new file mode 100644
index 0000000..14c87eb
--- /dev/null
+++ b/kvm.html
@@ -0,0 +1,111 @@
+<!DOCTYPE html>
+
+<html lang="en-us">
+ <head>
+ <meta charset="UTF-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <meta name="author" content="Rafael Marçalo">
+ <meta name="description" content="Create a Virtual Machine using KVM">
+ <link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
+ <link rel="stylesheet" type="text/css" href="styles/style.css">
+ <title>Create a Virtual Machine using KVM</title>
+ </head>
+ <body>
+ <div id="header">
+ <h1>Rafael Marçalo Website</h1>
+ <nav>
+ <a href="index.html">home</a>
+ |
+ <a href="archive.html">archive</a>
+ |
+ <a href="projects.html">projects</a>
+ |
+ <a href="donate.html">donate</a>
+ </nav>
+ </div>
+
+ <div id="content">
+
+ <h2>What is KVM</h2>
+ <p><em>"Kernel-based Virtual Machine (KVM) is an open source virtualization technology built into Linux®. Specifically, KVM lets you turn Linux into a hypervisor that allows a host machine to run multiple, isolated virtual environments called guests or virtual machines (VMs)."</em> - <a href="https://www.redhat.com/en/topics/virtualization/what-is-KVM">Red Hat, What is KVM?</a></p>
+
+ <h2>Install required packages</h2>
+ <p>To run a KVM virtual machine you need to have a Intel VT/AMD-V supported machine and you need to be running any sort of Linux distribution which provides virt-manager, libvirt and qemu packages.</p>
+ <p>For this instance I'm currently running a Artix GNU/Linux distribution(same as Arch Linux), but all the steps should be significantly the same for other distributions excluding the package names</p>
+
+ <h3>Required Packages</h3>
+ <ul>
+ <li><code>libvirt</code>;</li>
+ <li><code>virt-manager</code>;</li>
+ <li><code>qemu-desktop</code>;</li>
+ <li><code>edk2-ovmf</code> (Optional, but required if you're trying to virtualize Windows 11);</li>
+ <li><code>swtpm</code> (Optional, but required if you're trying to virtualize Windows 11).</li>
+ </ul>
+
+ <h2>Prepairing Virt-Manager</h2>
+
+ <h3>Setting up a user session</h3>
+ <p>After installing these packages according the OS you're running, you must now open virt-manager and create a new connection to a user qemu/kvm session. You do this by going into the file menu and by clicking on the <code>Add Connection...</code> option.</p>
+ <p>Now in the <code>Hypervisor</code>, select <code>QEMU/KVM user session</code>.</p>
+
+ <h3>Enabling XML Editing (Optional, but required if installing Windows 11)</h3>
+ <p>Since each VM is configured in XML in th backend, XML editing will allow you to have more control over your VM.</p>
+ <p>To do this, all you have to do is, go to the Edit menu, and select <code>Preferences</code>, now just tick on the option that says <code>Enable XML editing</code>.</p>
+
+ <h2>Setting up the Virtual Machine</h2>
+ <p>In this section I'll be going over the steps to install Windows 11 on KVM. Some of the steps will be marked with a optional marker, which means, that the referred stage is specific to Windows 11 only.</p>
+
+ <h3>Creating the Virtual Machine</h3>
+ <p>Firstly you must click the "➕" icon and select the <code>Local install media (ISO image or CDROM)</code> option.</p>
+
+ <h3>Install media</h3>
+ <p>Now go ahead and choose your installation ISO, if the OS is not automatically detected, select it manually or choose something similar to what you are trying to virtualize.</p>
+ <p><small><strong>Tip:</strong> When browsing for the iso, there's no need to create a pool, you can just click on <code>Browse local</code> and click on the desired ISO file</small></p>
+
+ <h3>Ram and CPU</h3>
+ <p>After selecting the disk, you'll be prompted with the memory and CPU settings, in this stage my only advice is to use at least 2GiB of ram.</p>
+
+ <h3>Storage</h3>
+ <p>Next up you'll be prompted with virtual storage, I recommend at least 25GiB if you're running Windows, if you're running any Linux distro I'd give it at least 15GiB.</p>
+
+ <h3>Customize Installation (Optional, but required if installing Windows 11)</h3>
+ <p>For a Windows 11 installation you need to have a UEFI, secure boot capable machine with the TPM(Trusted Platform Module) minimum version 2.0. Ahead I'll show how to take care of each instance.</p>
+
+ <h4>TPM Module</h4>
+ <p>After selecting the desired storage, go ahead and tick on the option that says <code>Customize configuration before install</code>.</p>
+ <p>Here you must click on <code>Add Hardware</code> and select the TPM category</p>
+ <p>Under TPM, the type must be <code>Emulated</code>. In advanced options, the model must be <code>TIS</code> and the version <code>2.0</code>.</p>
+
+ <h4>Secure Boot</h4>
+ <p>Still in the <code>Customize configuration before install</code> window, go over to the <code>Overview</code> category and set the firmware to something like <code>UEFI x86_64: /usr/share/edk2-ovmf/x64/OVMF_CODE.secboot.fd</code></p>
+ <p>After changing the firmware there are some hardware modules that won't working, so we must remove them to evade conflicts. To do this, still in the <code>Overview</code> category, go over to the <code>XML</code> tab and remove the lines below:</p>
+
+ <pre><code>&lt;controller type="pci" model="pcie-root"/&gt;
+&lt;controller type="pci" model="pcie-root-port"/&gt;
+&lt;controller type="pci" model="pcie-root-port"/&gt;
+&lt;controller type="pci" model="pcie-root-port"/&gt;
+&lt;controller type="pci" model="pcie-root-port"/&gt;
+&lt;controller type="pci" model="pcie-root-port"/&gt;
+&lt;controller type="pci" model="pcie-root-port"/&gt;
+&lt;controller type="pci" model="pcie-root-port"/&gt;
+&lt;controller type="pci" model="pcie-root-port"/&gt;
+&lt;controller type="pci" model="pcie-root-port"/&gt;
+&lt;controller type="pci" model="pcie-root-port"/&gt;
+&lt;controller type="pci" model="pcie-root-port"/&gt;
+&lt;controller type="pci" model="pcie-root-port"/&gt;
+&lt;controller type="pci" model="pcie-root-port"/&gt;
+&lt;controller type="pci" model="pcie-root-port"/&gt;</code></pre>
+
+ <h3>Finishing Installation</h3>
+ <p>Now that you have everything setup to run the VM, just hit <code>Finish</code> or <code>Begin Installation</code>.</p>
+ </div>
+
+ <div id="footer">
+ <div id="contact">
+ <p>Links: <a href="https://gitlab.com/rafa_99">Gitlab</a> | <a href="https://gitlab.com/rafa_99/rafa_99.gitlab.io.atom">RSS Feed</a></p>
+ <p>GPG: <a href="files/rafael.gpg">Public Key</a></p>
+ <p>License: <a href="https://www.gnu.org/licenses/gpl-3.0.txt">GPLv3</a></p>
+ </div>
+ </div>
+ </body>
+</html>