Important! I’ve had a bad experience with Contabo provider and wouldn’t recommend you buying VPS there. But if you did so …
The page was inspired by https://raymii.org/s/tutorials/Windows_7_Installer_on_KVM_Linux_VPS_Digital_Ocean.html and http://manpages.ubuntu.com/manpages/xenial/man1/wimlib-imagex-update.1.html pages.
First, boot VPS with Debian 9 live on Rescue system select page. Enter booted OS by VNC and open terminal
Install packages that we’ll need further:
sudo su;
apt-get install gparted filezilla grub2 wimtools;
Open gparted, delete all partitions, create two NTFS partitions (may be equal partitions), apply and close
Change GPT or any other partition table to MBR type - gdisk /dev/sda;
commands r, g, p, w; Y
Create dirs and mount partitions onto them
mount /dev/sda1 /mnt;
cd ~;
mkdir disk;
mount /dev/sda2 disk
Install grub on the first partition - grub-install --root-directory=/mnt /dev/sda
. Then add grub boot entry /mnt/boot/grub/grub.cfg with content
menuentry "Windows Installer" {
insmod ntfs
search --set=root --file /bootmgr
ntldr /bootmgr
boot
}
Copy Windows ISO and virtio ISO/files to /root/disk folder. Then, extract content of Windows DVD to bootable partition with Grub
cd /root/disk;
mkdir m;
mount -o loop win.iso m;
rsync -avz --progress m/* /mnt;
umount m;
Copy VirtIO drivers to “sources” folder of windows installation data
mount -o loop virtio.iso m;
mkdir /mnt/sources/virtio;
rsync -avz --progress m/* /mnt/sources/virtio;
cd /mnt/sources
Inject VirtIO drivers into boot.wim (2nd partition with Windows setup, run wimlib-imagex info
for more details) to be able to use them while installing Windows onto the VM.
touch cmd.txt;
echo 'add virtio /virtio_drivers' >> cmd.txt;
wimlib-imagex update boot.wim 2 < cmd.txt
Reboot the virtual machine and start Windows instalation. On drivers step browse your installation image and use VirtIO drivers previously injected