Create a Windows Virtual Machine Image from ISO

This guide provides step-by-step instructions for creating a Windows VM using an ISO.

This method creates a Windows VM image on an Ubuntu machine first using the ISO, then creates a virtual machine using that image. If you'd like a more direct recipe to create a Windows VM from an ISO, follow this tutorial instead.

Prerequisites

  • A Ubuntu 22.04 host - we will use this to prepare the Windows image using the ISO.
  • GUI access for the Ubuntu machine - this will be required to follow the Windows installation prompts.
  • A Windows ISO image

Step 1: Download the Stable VirtIO Driver ISO

Windows requires VirtIO drivers for better performance on a linux (QEMU-KVM) hypervisor. Download the latest stable VirtIO driver ISO on your Ubuntu host by running the following command:

Bash
Copy

This ISO contains drivers for storage, networking, and other virtual devices required during Windows installation.

Step 2: Install Required Packages

Install QEMU-KVM, TPM emulator, and other required packages on the Ubuntu host machine.

Bash
Copy
  • qemu-kvm: Virtual machine manager.
  • swtpm, swtpm-tools: Software TPM emulator for Windows security features.

Step 3: Start the TPM Emulator

Windows 11 requires a TPM. Create a directory for the TPM emulator on your host:

Bash
Copy

This directory will be used to store TPM-related files required for Windows installation.

Now run the following command on the host to start the TPM emulator in the background or a separate terminal.

Bash
Copy

This command initializes a TPM 2.0 emulation environment needed for Windows installation.

Step 4: Create a Blank qcow2 Disk Image

Now create a qcow2 disk image on the Ubuntu host. We will use this for Windows installation.

Bash
Copy
  • VIRTUAL_DISK_FILE_NAME: Name of the virtual disk file.
  • VIRTUAL_DISK_SIZE: Size of the disk (adjust as needed).

Step 5: Start the Windows Installation

Now use QEMU to start the installation process on the host, using the Windows ISO.

Bash
Copy
  • -cdrom test.iso: Mounts the Windows installation ISO.
  • -cpu Skylake-Client-v3 -enable-kvm: Enables hardware acceleration.
  • -m 4096: Allocates 4GB RAM to the VM.
  • -smp 2: Allocates 2 CPU cores.
  • -device tpm-tis,tpmdev=tpm0: Enables TPM 2.0 emulation.
  • -drive if=virtio,file=win11,format=qcow2: Attaches the previously created disk.
  • -drive file=virtio.iso,index=1,media=cdrom: Mounts the VirtIO driver ISO.

Step 6: Install VirtIO Drivers During Windows Setup

During installation:

  • Click Load Drivers when prompted.
  • Browse to the mounted VirtIO ISO and select appropriate drivers.
  • Proceed with the installation.

Step 7: Shut down the VM and Prepare for Deployment

Once Windows installation is complete, shut down the VM.

The Windows image is now ready for Private Cloud Director use.

Uploading the Image

To deploy the image in Private Cloud Director:

  • Make sure the image is in qcow2 format for Private Cloud Director use.
  • Upload the image using Private Cloud Director Image Library UI or CLI. Follow Import Images into Image Library for steps to upload the image.
Type to search, ESC to discard
Type to search, ESC to discard
Type to search, ESC to discard
  Last updated