For Linux users, start from the beginning. For Windows users, start from dependencies installation.
Unofficial, clean, non-activated Windows 10 Pro image built from https://www.microsoft.com/en/software-download/windows10ISO
docker pull docker.io/alekseychudov/windows-10-pro:1912
It is further assumed that Docker uses the overlay2 storage driver.
$ docker info | grep 'Storage Driver'
Storage Driver: overlay2
image="$(docker inspect --format {{.GraphDriver.Data.UpperDir}} docker.io/alekseychudov/windows-10-pro:1912)/images/Windows-10-Pro.qcow2.gz"
sudo pigz -c -d "${image}" | sudo dd of=/var/lib/libvirt/images/win10.localhost.qcow2 status=progress
sudo qemu-img resize /var/lib/libvirt/images/win10.localhost.qcow2 100G
sudo qemu-img info /var/lib/libvirt/images/win10.localhost.qcow2
mkdir -pv cloudbase-init/openstack/latest
echo '{"admin_pass": "L1bv!rt", "hostname": "win10"}' > cloudbase-init/openstack/latest/meta_data.json
sudo genisoimage -input-charset utf-8 -joliet -rock -volid config-2 \
-output /var/lib/libvirt/images/win10.localhost.iso cloudbase-init
sudo virt-install \
--name win10.localhost \
--memory 4096 \
--vcpus 4 \
--cpu host \
--import \
--disk /var/lib/libvirt/images/win10.localhost.qcow2,device=disk,bus=virtio \
--disk /var/lib/libvirt/images/win10.localhost.iso,device=cdrom \
--network default \
--graphics spice \
--channel unix,target_type=virtio,name=org.qemu.guest_agent.0 \
--virt-type kvm \
--os-variant win10 \
--noautoconsole
The very first start-up takes some time due to initial setup and restarts. Connect to the virtual machine using Virtual Machine Manager to find out what is going on.
If the Libvirt NSS module is installed, you can connect to the virtual machine directly by name. Otherwise, you can find out the address of the virtual machine using the below command.
sudo virsh domifaddr win10.localhost
Default username is "Administrator" and password is "L1bv!rt". Change it as soon as possible!
xfreerdp /v:win10.localhost /u:Administrator
The very first login takes some time due to initial setup.
If using the libvirt virtual machine, type the following commands:
$ sudo virsh domblklist win10.localhost
Target Source
------------------------------------------------
vda /var/lib/libvirt/images/win10.localhost.qcow2
sda /var/lib/libvirt/images/win10.localhost.iso
$ sudo virsh change-media win10.localhost sda --eject
Successfully ejected media.
$ sudo virsh change-media win10.localhost sda /var/lib/libvirt/images/windows.iso --insert
Successfully inserted media.
Open PowerShell as Administrator and type the following commands.
Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope CurrentUser
git clone https://github.com/cloudbase/windows-openstack-imaging-tools.git
cd windows-openstack-imaging-tools
git submodule add https://github.com/AlekseyChudov/windows-kvm-imaging-tools.git
windows-kvm-imaging-tools\create-windows-online-kvm-image.ps1
Upon successful completion you will have the following qcow2 image.
build\Windows-<version>.qcow2
Congrats! You can add Windows image building skills to your resume :)
https://github.com/cloudbase/windows-openstack-imaging-tools