If you're looking for "virgin" files for KVM (Kernel-based Virtual Machine), this typically means you need:
This guide walks you through creating a completely fresh KVM virtual machine from scratch.
Start with a fresh, verified ISO from official sources. Here are direct links to popular operating systems:
Once downloaded, move the ISO to KVM's standard image directory:
# Create directory if it doesn't exist
sudo mkdir -p /var/lib/libvirt/images/
# Move or download directly to the directory
sudo mv ~/Downloads/ubuntu-22.04.iso /var/lib/libvirt/images/
# Or download directly using wget
sudo wget -O /var/lib/libvirt/images/ubuntu-22.04.iso https://releases.ubuntu.com/22.04/ubuntu-22.04-live-server-amd64.iso
Create a pristine disk image that will serve as the virtual machine's storage.
sudo qemu-img create -f raw /var/lib/libvirt/images/clean_vm.img 20G
RAW format offers near-native performance but doesn't support advanced features like snapshots.
sudo qemu-img create -f qcow2 /var/lib/libvirt/images/clean_vm.qcow2 20G
QCOW2 (QEMU Copy-On-Write) supports snapshots, compression, and encryption. It's the recommended format for most KVM deployments.
# List files in the images directory
ls -lah /var/lib/libvirt/images/
# Check disk image info
sudo qemu-img info /var/lib/libvirt/images/clean_vm.qcow2
With your clean ISO and disk image ready, create a new VM using the virt-install command.
sudo virt-install \
--name clean_vm \
--ram 2048 \
--vcpus 2 \
--disk path=/var/lib/libvirt/images/clean_vm.qcow2,format=qcow2 \
--cdrom /var/lib/libvirt/images/ubuntu-22.04.iso \
--os-type linux \
--network network=default \
--graphics vnc \
--boot menu=on
This creates a KVM VM with the following specifications:
clean_vm--os-type linux to --os-type windows.
# Start the VM (if not started automatically by virt-install)
sudo virsh start clean_vm
# Check VM status
sudo virsh list --all
# Find the VNC display port
sudo virsh vncdisplay clean_vm
# Output will be like: :0 or :1
# Connect with a VNC client to localhost:5900 (for :0) or localhost:5901 (for :1)
# Connect to the serial console
sudo virsh console clean_vm
# To exit the console, press: Ctrl + ]
# Get the VM's IP address
sudo virsh domifaddr clean_vm
# SSH into the VM (after OS installation and network configuration)
ssh username@vm_ip_address
If you need to delete an old VM completely and start fresh with virgin files:
# 1. Shutdown the VM if it's running
sudo virsh destroy old_vm
# 2. Undefine the VM from libvirt
sudo virsh undefine old_vm
# 3. Delete the disk image file
sudo rm -rf /var/lib/libvirt/images/old_vm.qcow2
# 4. Optional: Delete any associated ISO files
sudo rm -rf /var/lib/libvirt/images/old_vm.iso
Now you can create a completely clean KVM setup with virgin files.
| Step | Command/Action |
|---|---|
| Download fresh ISO | Get from Ubuntu, Debian, CentOS, Windows official sites |
| Create clean KVM disk | qemu-img create -f qcow2 /var/lib/libvirt/images/clean_vm.qcow2 20G |
| Install new VM | Use virt-install with ISO, disk, RAM, and vCPU parameters |
| Start the VM | virsh start clean_vm |
| Access VM | VNC: virsh vncdisplay clean_vm or console: virsh console clean_vm |
| Delete old VM | virsh destroy old_vm && virsh undefine old_vm && rm -rf /var/lib/libvirt/images/old_vm.qcow2 |
Following these steps will give you a clean, untouched ("virgin") KVM virtual machine ready for your custom configuration!