11 November, 2013

Automated installation of Windows 7 in KVM

Sometimes I need to test/work with Windows 7 in my libvirt/KVM virtualization. Because the testing can be destructive I decided to automate it as much as possible. As a linux user there is not much options to modify ISO image and create fully unattended installation, because I need the "windows only" tools for that. I also don't want to use unattended configs shared by SAMBA, because it looks too complex for one VM.

Anyway here is the description of solution how I'm "fighting" with the automated Windows installation in the Virtual Machine manager.

Here are the screenshots from the VirtManager:

As you can see above I decided to use VirtIO for disk access to get the best performance. In such case I'll need the Windows VirtIO Drivers otherwise the disk is not going to be visible.
I decided to create my own iso image which I used as the second CD-ROM drive. This has two advantages - I can put there the VirtIO drivers and the "autostart.bat" script which needs to be executed manually after first boot.

Here is a short script how to create such iso:

Another screenshot showing the second CD-ROM with the autostart.iso:

Once the installation of the Windows 7 is completed you should run the "autostart.bat" using the "Run as administrator" option.
It will download the win7-admin.bat and download+run win7-user.bat.

You can see the content of the win7-user.bat here:

After the restart you should login as Administrator (with password "xxxx") and complete installation by running c:\win7-admin.bat shown here:

Feel free to see whole installation procedure on this video (some parts are accelerated):


No comments :

Post a Comment