> [!sub]- [[📌Subscribe & Engage|🧡FREE subscriber-only Products. Subscribe and get a chance to win!]]
## Introduction
A [[KVM]] is used whenever we want to run [[OS]]s which have a different [[kernel]] or security requirements to the [[PVE]] host (host-[[OS]]), like for example [[Android]], [[BSD]], [[Docker]], [[Linux]] [[Desktop]], [[MacOS]], [[Windows]]. Creation of [[KVM]]s is a more involved process to [[LXC]] creation, as they are more tightly linked to the guest-[[OS]].
[[Linux]] [[Desktop]] [[distro]]s should always be installed in a [[KVM]]. Using [[LXC]], although sometimes might work, cannot be relied upon for long-term production use; for example, future updates might break the installation.
[[Docker]]-based production-grade installations should also use a [[KVM]] instead of an [[LXC]]. For non-critical work [[LXC]]s are fine, but be mindful future [[Docker]] updates might break installations.
In the next section are suggestions for the most common [[WUI]] settings. For detailed setup, refer to my other articles for different systems and applications (e.g. [[debian]], [[ubuntu]], [[fedora]], [[windows]], [[mac]], [[android]], [[home assistant]], [[docker]], [[mqtt]], [[node-red]], etc), or visit the official documentation links throughout this article.
[[KVM]]s can be created and managed using the [[WUI]] and/or [[CLI]]. The [[CLI]] commands are commonly used in virtualisation automation, useful when dealing with complex and large-scale infrastructure.
In any [[KVM]] a guest-[[OS]] must be installed and therefore the guest-[[OS]] image should be first downloaded in the [[PVE]] host/node. This can be accomplished by using any of the following methods:
- Upload the guest-[[OS]] [[ISO]] image; upload uses a local disk or [[LAN]] share
- Download straight from a [[URL]], i.e. directo from the [[cloud]]/[[web]]
<button class="navigate">local (pve)</button> <button class="navigate">ISO Images</button> <button class="navigate">Upload</button>
or
<button class="navigate">local (pve)</button> <button class="navigate">ISO images</button> <button class="navigate">Download from URL</button>
![[pve-kvm-0-0.png]]
> [!info]- Useful PVE documentation links
>
> [webUI ref](https://pve.proxmox.com/pve-docs/pve-admin-guide.html#qm_virtual_machines_settings)
> [CLI ref](https://pve.proxmox.com/pve-docs/chapter-qm.html#_cli_usage_examples)
> [Config ref](https://pve.proxmox.com/pve-docs/chapter-qm.html#qm_configuration)
## Create [[KVM]] using [[WUI]]
<button class="navigate">Node</button> → <button class="navigate">Create VM</button>
![[pve-kvm-0-1.png]]
### General
> ref: [general settings - Proxmox](https://pve.proxmox.com/pve-docs/chapter-qm.html#qm_general_settings)
> ref: [startup & shutdown - Proxmox](https://pve.proxmox.com/pve-docs/chapter-qm.html#qm_startup_and_shutdown)
<span class="fieldname">Node</span>: fixed value string on single node (non-clustered) setup (e.g. `pve`)
<span class="fieldname">VM ID</span>: any unique number >= `100` and <= `999999999` (e.g. `100`)
<span class="fieldname">Name</span>: any unique alphanumeric string, naming the [[KVM]] (e.g. `kvm`)
<span class="fieldname">Start at boot</span>: `enable` | `disable`
<span class="fieldname">Advanced</span>: <code style="color:#ffffff">enable</code>
<button class="navigate">Next</button>
![[pve-kvm-1.png]]
### OS
> ref: [OS settings - Proxmox](https://pve.proxmox.com/pve-docs/chapter-qm.html#qm_os_settings)
<span class="fieldname">Use CD/DVD disc image file (iso):</span> - select the most appropriate [[ISO]] from local or remote storage
<span class="fieldname">Guest OS Type:</span> - `Linux` | `Windows` | `Other` | ...
<span class="fieldname">Guest OS Version:</span> - OS dependant
<button class="navigate">Next</button>
![[pve-kvm-2.png]]
### System
> ref: [system settings - Proxmox](https://pve.proxmox.com/pve-docs/chapter-qm.html#qm_system_settings)
> ref: [display - Proxmox](https://pve.proxmox.com/pve-docs/chapter-qm.html#qm_display)
> ref: [qemu agent - Proxmox](https://pve.proxmox.com/pve-docs/chapter-qm.html#qm_qemu_agent)
> ref: [bios & uefi - Proxmox](https://pve.proxmox.com/pve-docs/chapter-qm.html#qm_bios_and_uefi)
> ref: [tpm - Proxmox](https://pve.proxmox.com/pve-docs/chapter-qm.html#qm_tpm)
<span class="fieldname">Graphic card</span>: <code style="color:#ffffff">Default</code> | <code style="color:#ffffff">VirGL GPU</code> | `VirtIO GPU` | ... - use `Default` when the only interface offered by the guest-[[OS]] is [[CLI]]
<span class="fieldname">SCSI Controller</span>: <code style="color:#ffffff">VirtIO SCSI single</code> | `VirtIO SCSI` | ...
<span class="fieldname">Machine</span>: <code style="color:#ffffff">q35</code> | `i440fx`
<span class="fieldname">Qemu Agent</span>: <code style="color:#ffffff">enable</code> | <code style="color:#999999">disable</code>
<span class="fieldname">BIOS</span>: <code style="color:#ffffff">OVMF (UEFI)</code> | `SeaBIOS`
<span class="fieldname">Add EFI Disk</span>: <code style="color:#ffffff">enable</code> | <code style="color:#999999">disable</code>
<span class="fieldname">EFI Storage</span>: `local-lvm` | `local-zfs`
<span class="fieldname">Pre-Enroll keys</span>: `disable` (for [[Windows]] only `enable`)
<span class="fieldname">Add TPM</span>: `disable` (for [[Windows]] 11 `enable`)
<button class="navigate">Next</button>
![[pve-kvm-3.png]]
### Disks
> ref: [hard disk - Proxmox](https://pve.proxmox.com/pve-docs/chapter-qm.html#qm_hard_disk)
> ref: [storage pools - Proxmox](https://pve.proxmox.com/pve-docs/chapter-pvesm.html#_storage_pools)
<span class="fieldname">Storage</span>: `local-lvm` | `local-zfs`
<span class="fieldname">Disk size (GiB)</span>: a numerical value > `0`, based on requirements (e.g. `32`)
<span class="fieldname">Discard</span>: <code style="color:#ffffff">enable</code> - for mechanical storage `disable`
<span class="fieldname">IO thread</span>: <code style="color:#ffffff">enable</code> - always `enable` if `VirtIO SCSI single` is selected to attain best performance
<span class="fieldname">SSD emulation</span>: <code style="color:#ffffff">enable</code> - for mechanical storage `disable`
<button class="navigate">Next</button>
![[pve-kvm-4.png]]
### CPU
> ref: [cpu - Proxmox](https://pve.proxmox.com/pve-docs/chapter-qm.html#qm_cpu)
> ref: [KVM CPU model configuration on x86 hosts - QEMU](https://www.qemu.org/docs/master/system/i386/cpu.html)
<span class="fieldname">Cores</span>: a numerical value > `0`, based on requirements (e.g. `1`)
<span class="fieldname">Type</span>: <code style="color:#ffffff">host</code> | `kvm64` | `qemu64` | ...
<button class="navigate">Next</button>
![[pve-kvm-5.png]]
### Memory
> ref: [memory - Proxmox](https://pve.proxmox.com/pve-docs/chapter-qm.html#qm_memory)
<span class="fieldname">Memory (MiB)</span>: a numerical value >= <span class="fieldname">Minimum Memory (MiB)</span>, based on max memory requirements
<span class="fieldname">Minimum Memory (MiB)</span>: a numerical value > `64` and <= <span class="fieldname">Memory (MiB)</span>, based on min memory requirements
<span class="fieldname">Ballooning Device</span>: <code style="color:#ffffff">enable</code> - kernel driver to monitor memory usage
<button class="navigate">Next</button>
![[pve-kvm-6.png]]
### Network
> ref: [network device - Proxmox](https://pve.proxmox.com/pve-docs/chapter-qm.html#qm_network_device)
No change from defaults
<button class="navigate">Next</button>
![[pve-kvm-7.png]]
### Confirm
<span class="fieldname">Start after created</span>: `enable` | `disable`
<button class="navigate">Finish</button>
![[pve-kvm-8.png]]
At this point the [[KVM]] has been created and the next step is [[KVM]] setup.