# Create virtual machines from ISO images

> Learn how to boot a virtual machine from a guest ISO file to manually install operating systems that don't have a ready-made cloud image available.

## Create virtual machine from ISO image overview {#create-virtual-machine-from-iso-image-overview}

When a cloud image isn't available for your guest operating system, you can install it manually by booting from a guest ISO file. This guide covers ISO-based virtual machine installation for the Windows guest operating system.

The installation process requires preparing and uploading the right images, running a CLI command to configure the virtual hardware, and converting the finished installation into a reusable Glance image template. Once complete, the template can be used to deploy new virtual machines without repeating the installation process.

### What you'll do {#what-youll-do}

1. **Obtain the prerequisite images**: Download the Windows installation ISO and any required driver images. For Windows guests, this typically includes the VirtIO driver ISO to ensure proper hardware compatibility.
2. **Upload and configure the images**: Add your ISO files to the environment and attach them to a new virtual machine. This step configures the virtual hardware so the VM can boot from the installation media.
3. **Install the operating system**: Boot the VM from the ISO and complete the Windows installation. This mirrors a standard OS installation, with a few guest-specific steps for driver setup.
4. **Convert the VM to a template**: Once installation is complete, generalize the installed volume and save it as a reusable image template in Glance. This is the master image your future VMs will be built from.
5. **Deploy VMs from the template**: Use the saved template to launch new Windows VMs on demand — consistent, repeatable, and ready to use.

## Prerequisites {#prerequisites-for-creating-a-virtual-machine-from-an-iso-image}

To create a virtual machine using an ISO image, you need the following files:

1. **ISO images**: Download a bootable ISO of your guest operating system using official sources or repositories.
2. **VirtIO driver pack**: For optimal compatibility and performance on CubeCOS, install the VirtIO drivers for Windows operating systems.

## Upload prerequisite ISO images to the CubeCOS image store {#upload-pre-requisite-iso-images-to-the-cubecos-image-store}

### Upload custom ISO images {#upload-custom-iso-images}

1. On your local machine, download the required ISO image from the official operating system vendor or a verified repository.
2. Open a terminal session.
3. Upload the ISO images to the CubeCOS image store with the `scp` command from a computer with management access to your cluster VIP.

   Replace the image name and cluster IP in the following command:

   ```bash
   scp replace-with-your-image-name.iso root@<your-cluster-vip>:/mnt/cephfs/glance/
   ```

4. Wait for the upload to complete. The time required depends on the image size and network bandwidth.

### Upload VirtIO driver packs {#upload-virtio-driver-packs}

1. Download the VirtIO driver pack from [the stable VirtIO download page](https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/stable-virtio/virtio-win.iso).
2. Open a terminal session.
3. Upload the ISO images to the CubeCOS image store with the `scp` command from a computer with management access to your cluster VIP.

   Replace the image name and cluster IP in the following command:

   ```bash
   scp virtio-win.iso root@<your-cluster-vip>:/mnt/cephfs/glance/
   ```

4. Wait for the upload to complete. The time required depends on the image size and network bandwidth.

## Prepare installation volumes for virtual machine installation {#prepare-installation-volumes-for-virtual-machine-installation}

The ISO image and the driver packs have to be imported as image before they can be attached as volumes during virtual machine installation.

:::tip[Repeat action for OS ISO and driver pack]

Before proceeding, repeat the process for the following:

1. The operating system installation ISO.
2. If applicable, the driver pack.

:::

1. Open a terminal session.
2. Connect to the cluster VIP via SSH and login as the `root` user

   ```bash
   ssh root@<your-cluster-vip>
   ```

3. Verify that your ISO was uploaded successfully to the image directory.

   ```bash
   ls /mnt/cephfs/glance/
   ```

4. Create the bootable volume uploaded image.
   - For **Windows**, use the **Windows OS** tab to include the extra OS specification required for Windows systems.
   - For **Linux** and other installation media (including VirtIO driver packs), use the **Linux and other OS** tab.

   
   

   ```bash
   openstack image create \
   --disk-format iso \
   --container-format bare \
   --public \
   --property hw_firmware_type=uefi \
   --property hw_machine_type=q35 \
   --property hw_scsi_model=virtio-scsi \
   --property hw_disk_bus=virtio \
   --property os_secure_boot='optional' \
   --property os_type=windows \
   --file <replace-with-full-path-to-iso-image>.iso \
   <replace-with-imported-image-name>.iso
   ```

      
      
      ```bash
      openstack image create \
      --disk-format iso \
      --container-format bare \
      --public \
      --property hw_firmware_type=uefi \
      --property hw_machine_type=q35 \
      --property hw_scsi_model=virtio-scsi \
      --property hw_disk_bus=virtio \
      --property os_secure_boot='optional' \
      --file <replace-with-full-path-to-iso-image>.iso \
      <replace-with-imported-image-name>.iso
      ```
      
      

## Create the template virtual machine {#create-bootable-iso-based-virtual-machines}

Creating ISO-based virtual machines requires manual interaction through the Nova command-line interface (CLI).

### Create the ISO-based virtual machine via the CLI {#set-and-execute-the-iso-based-virtual-machines-create-command-via-nova-cli}

1. Open a terminal prompt with SSH.
2. Connect to the cluster VIP via SSH and login as the `root` user

   ```bash
   ssh root@<your-cluster-vip>
   ```

3. To create a template virtual machine, execute the command after replacing the following parameters.
   1. **Virtual machine name**: Enter the display name for the virtual machine.
   2. **Flavor**: Enter the flavor detail to allocate the resources to the virtual machine.
   3. **Network**: Obtain the ID of the network by going to **Network** > **Networks**, and copy the network ID for the virtual machine to use.
   4. **Boot image UUID**: Navigate to **Compute** > **Images**, and copy the image ID for the ISO boot media.
   5. **(Applicable only to Windows machines) Virtio driver UUID**: Navigate to **Compute** > **Images**, and copy the image ID for the VirtIO driver media.
   6. **Size of boot volume**: The desired size of the boot volume in GB.

   
   

   ```bash
   openstack server create <replace-with-virtual-machine-name> \
   --flavor <replace-with-flavor-size> \
   --network <replace-with-network-uuid> \
   --block-device source_type=image,uuid=<replace-with-boot-media-id>,destination_type=volume,volume_size=10,disk_bus=sata,device_type=cdrom,boot_index=0 \
   --block-device source_type=image,uuid=<replace-with-virtio-media-id>,destination_type=volume,volume_size=10,disk_bus=sata,device_type=cdrom,boot_index=1 \
   --block-device source_type=blank,destination_type=volume,volume_size=<replace-with-size-of-boot-volume>,disk_bus=virtio,device_type=disk,boot_index=2
   ```

   
   
   ```bash
   openstack server create <replace-with-virtual-machine-name> \
   --flavor <replace-with-flavor-size> \
   --network <replace-with-network-uuid> \
   --block-device source_type=image,uuid=<replace-with-boot-media-id>,destination_type=volume,volume_size=10,disk_bus=sata,device_type=cdrom,boot_index=0 \
   --block-device source_type=blank,destination_type=volume,volume_size=<replace-with-size-of-boot-volume>,disk_bus=virtio,device_type=disk,boot_index=2
   ```
   
   

4. Open the CubeCOS web-based management UI and verify that the instance is successfully created and in the `Active` or `Build` state.

   ![Verify Windows VM build in management UI](/assets/compute/create-vm-from-iso-win_vm_build_verification.png)

## Install ISO-based virtual machines {#launch-and-boot-iso-based-virtual-machines}

### Install a Windows guest OS using the virtual console {#install-a-windows-11-guest-os-with-the-virtual-console}

With the VM booted from the Windows installation ISO, install the required VirtIO drivers before completing OS setup. These drivers enable Windows to recognize the virtual network interface and storage disk provided by CubeCOS. Without them, the installer will not detect the boot disk, and network connectivity will be unavailable during and after installation.

1. When prompted, `Press any key to boot from CD or DVD`.

   ![Windows UEFI boot console view](/assets/compute/create-vm-from-iso-windows_uefi_boot.png)

2. To browse the required drivers from the VirtIO driver pack, select `Load Driver` to browse the directories.

   ![Verify Windows VM build in management UI](/assets/compute/create-vm-from-iso-windows_install_console.png)

3. Select the `virtio-win-<version>` disk and install the following required drivers:
   1. `NetKVM`: The network driver to support network during installation and for post-installation processes.
      1. Open the `NetKVM` folder.
      2. Select the folder that corresponds to your Windows version.
      3. To scan the folder for drivers, select the `amd64` folder, then click scan.
      4. Click next to install the driver.
   2. `viostor`: Storage driver required to detect the `virtio` disk attached by CubeCOS.
      1. Open the `viostor` folder.
      2. Select the folder that corresponds to your Windows version.
      3. To scan the folder for drivers, select the `amd64` folder, then click scan.
      4. Click next to install the driver.

   ![Select required VirtIO driver](/assets/compute/create-vm-from-iso-virtio_drivers_pack_directory.png)

4. Select the disk for install and complete the guest OS installation.
5. After the operating system reboots, login with the default credentials.
6. Navigate to the mounted `virtio-win-<version>` folder.
7. Install the following packages in order with adminsitrator privilege:
   1. `virtio-win-gt-x64.msi`: This installs all the relevant drivers for the guest OS to function correctly on CubeCOS.
   2. `virtio-win-guest-tool.exe`: The guest tools provides performance monitoring and required for snapshot protection support in the virtual guests.

## Convert the installed virtual machine to image template {#convert-the-installed-virtual-machine-to-image-template}

Once the guest OS installation is complete, convert the VM's boot volume to a Glance image. The resulting image serves as a reusable deployment template for future virtual machines of the same configuration.

1. Navigate to `Storage > Volumes` and locate the Windows guest OS volume.
2. Select the `More` dropdown on the Windows guest OS volume, go to `Data Protection > Create Image`.

   ![Select required VirtIO driver](/assets/compute/create-vm-from-iso-create_from_image.png)

3. On the `Create Image` dialogue window, enter:
   1. **Image Name**: Set your Windows guest OS template name.
   2. **Format**: Set the `RAW` disk format.

   ![Select required VirtIO driver](/assets/compute/create-vm-from-iso-convert_image_to_raw.png)

4. The image will begin uploading with the `Uploading` status.
   ![Select required VirtIO driver](/assets/compute/create-vm-from-iso-convertion_in_progress.png)

5. Go to `Compute > Images` verify the status of the newly created image, it will display `Saving` as the image is being create.

6. The image has been successfully uploaded once the status displays `Active`.

   ![Select required VirtIO driver](/assets/compute/create-vm-from-iso-ui_progress_verification.png)

### Add metadata to the image you just uploaded {#add-metadata-to-the-image-you-just-uploaded}

The uploaded image requires hardware and OS metadata to deploy correctly as a virtual machine template. These properties tell the hypervisor how to configure firmware, disk bus, and security features for the guest OS. Set the metadata via the administrator view in the CubeCOS management UI.

1. For how to switch to administrator view by clicking Administrator in the top-right corner, see [Access the administrator view](https://docs.bigstack.co/docs/cubecos/identity/administrator-view#enter-the-administration-panel).

   ![Select required VirtIO driver](/assets/compute/create-vm-from-iso-switch_to_administrative_view.png)

2. Select `Compute > Image` and locate the image you just uploaded.
3. To edit the metadata required, select the drop down for `More > Manage Metadata`.

   ![Select required VirtIO driver](/assets/compute/create-vm-from-iso-manage_metadata_parameters.png)

4. Add the following `metadata` fields to the image.

   :::info[Always match vTPM requirements for the guest OS]

   The following two items only need to be added if required by the Guest OS.
   - **hw_tpm_version** = 2.0
   - **hw_tpm_model** = tpm-crb

   :::

   :::warning[For Windows guest OS]

   You must set:
   - os_type=windows

   :::

   
   

   | Metadata field       | Value       |
   | -------------------- | ----------- |
   | **hw_firmware_type** | uefi        |
   | **hw_disk_bus**      | virtio      |
   | **hw_machine_type**  | q35         |
   | **hw_scsi_model**    | virtio-scsi |
   | **os_secure_boot**   | optional    |
   | **hw_tpm_version**   | 2.0         |
   | **hw_tpm_model**     | tpm-crb     |
   | **os_type**          | windows     |

   ![Select required VirtIO driver](/assets/compute/create-vm-from-iso-set_custom_metadata_parameters.png)

   
   

   | Metadata field       | Value       |
   | -------------------- | ----------- |
   | **hw_firmware_type** | uefi        |
   | **hw_disk_bus**      | virtio      |
   | **hw_machine_type**  | q35         |
   | **hw_scsi_model**    | virtio-scsi |
   | **os_secure_boot**   | optional    |

   
   

5. Select the image name to open its details and verify that all metadata has been applied correctly.

   ![Select required VirtIO driver](/assets/compute/create-vm-from-iso-verify_custom_metadata_parameters.png)

6. Once confirmed, you can create new virtual machines using this template.
