- Posted on
- • Server
Install Windows on Any Server using Rescue System and QEMU-KVM
- Author
-
-
- User
- danpros
- Posts by this author
- Posts by this author
-
Is this possible to install Windows using the rescue system? The short answer is Yes.
We just need to use the portable qemu-kvm. Portable here means we do not need to install it inside the rescue system but we just need to extract it inside the temporary folder, eg. /tmp
and execute the qemu-kvm from there.
# Download and extract the portable qemu-kvm to /tmp folder
wget -qO- /tmp http://www.danpros.com/content/files/vkvm.tar.gz | tar xvz -C /tmp
# Execute the qemu-kvm
/tmp/qemu-system-x86_64 -net nic -net user,hostfwd=tcp::3389-:3389 -m 2048M -localtime -enable-kvm -cpu host,+nx -M pc -smp 2 -vga std -usbdevice tablet -k en-us -cdrom /mnt/win8-64.iso -hda /dev/sda -boot once=d -vnc :1
To speedup all of things, we can check if the machine and the rescue system support KVM or not by doing this:
/tmp/kvm-ok
INFO: /dev/kvm exists
KVM acceleration can be used
Install Windows on any WSI preconfigured server
WSI has Core2Duo box @ $10/month and they don't provide KVM services for their preconfigured server.
Preconfigured Servers Cannot be Modified: Our preconfigured servers are designed for quick deployment. Preconfigured servers hardware (CPU/RAM/HDD) or bandwidth cannot be added or modified. Operating system options for preconfigured systems are limited to available selections on order form. KVM services are not provided for preconfigured servers.
But WSI provide SystemRescueCD and we can install Windows or any other OS using QEMU w/o KVM support. The Sysrcd lack of KVM module and it can only install 32 Bit OS (tested on WSI). Such a waste if we snap a preconfigured servers with more than 4GB RAM.
Previously I've asked them via their ticket system to add Grml https://grml.org/ (because of KVM module already enabled) and finally now they add it on their reload OS options, nice!
Start the Windows installation on WSI
First reload the OS and choose Grml. Open the SSH console using the password provided.
# CAREFULL Wipe your hard disks. Let say we want to install the Windows in /dev/sda
dd if=/dev/zero of=/dev/sda bs=1M count=1
partprobe
If you need temporary folder for the ISO. Need big RAM on this case (depend on the ISO size).
mount -t tmpfs -o size=4000m tmpfs /mnt
Or if we have RAM less than 8GB, we just need to creating small partition, put the ISO file there and don't touch it during Windows installations.
Note: My WSI $10 box have second HDD so just I put my ISO inside it.
Download the ISO to /mnt folder:
wget -P /mnt http://example.com/win8-64.iso
Download and extract the portable qemu-kvm. /tmp folder is enough for this portable qemu-kvm.
wget -qO- /tmp http://www.danpros.com/content/files/vkvm.tar.gz | tar xvz -C /tmp
You need to download the UEFI bios also to support more than 2TB partition.
wget -qO- /tmp http://www.danpros.com/content/files/uefi.tar.gz | tar xvz -C /tmp
Excute the qemu-kvm.
/tmp/qemu-system-x86_64 -net nic -net user,hostfwd=tcp::3389-:3389 -m 2048M -localtime -enable-kvm -cpu host,+nx -M pc -smp 2 -vga std -usbdevice tablet -k en-us -cdrom /mnt/win8-64.iso -hda /dev/sda -boot once=d -vnc :1
For UEFI.
/tmp/qemu-system-x86_64 -bios /tmp/uefi.bin -net nic -net user,hostfwd=tcp::3389-:3389 -m 2048M -localtime -enable-kvm -cpu host,+nx -M pc -smp 2 -vga std -usbdevice tablet -k en-us -cdrom /mnt/win8-64.iso -hda /dev/sda -boot once=d -vnc :1
Open the VNC viewer and visit your IP:1
to starting the installations.
Network and Driver
After finished, enable the RDP and turn-off the firewall temporary. You can add the network driver using:
pnputil.exe -a c:yourdriver.inf
Note: In my case Windows already have the driver but I still add the driver to the DriverStore.
WSI use static IP so we must setup the IP manually. Example IP from WSI:
IP: 63.141.x.x
Gateway: 63.141.x.x
Subnet Mask: 255.255.255.252
And we need to use DNS server provided by WSI also. Pick one below.
# First DNS server
192.187.107.16
69.30.209.16
# Second DNS server
208.67.220.220
208.67.222.222
This is what the support staff tell me when I can't connect even I already enable the RDP, install the network driver, and turn-off the firewall temporarily but I am enabling the DHCP.
Those are the DNS we set, once the service is online the client can change them to whatever they wish to use.
You can creating netsh script to setup the static IP automatically during startup or logon.
netsh interface ipv4 set address name="Ethernet 2" static 63.141.x.x 255.255.255.252 63.141.x.x
netsh interface ipv4 set dns name="Ethernet 2" static 192.187.107.16
netsh interface ipv4 add dns name="Ethernet 2" 69.30.209.16 index=2
Note: The default connection names are Ethernet and assigned to Qemu network interface. The IP address order: client IP, subnet mask, and gateway IP.
Make sure to double check everything before rebooting your server.
Troubleshot
Qemu can boot existing Windows installations so you just need to load the Grml, extract the portable qemu-KVM and reconfigure the Windows again.
/tmp/qemu-system-x86_64 -net nic -net user,hostfwd=tcp::3389-:3389 -m 2048M -localtime -enable-kvm -cpu host,+nx -M pc -smp 2 -vga std -usbdevice tablet -k en-us -cdrom /mnt/win8-64.iso -hda /dev/sda -boot c -vnc :1
For UEFI.
/tmp/qemu-system-x86_64 -bios /tmp/uefi.bin -net nic -net user,hostfwd=tcp::3389-:3389 -m 2048M -localtime -enable-kvm -cpu host,+nx -M pc -smp 2 -vga std -usbdevice tablet -k en-us -cdrom /mnt/win8-64.iso -hda /dev/sda -boot once=d -vnc :1
Credit to WSI
WSI staff is very helpful on this process, from debugging, even they are willing to add Grml because of SystemRescueCD limitations.
How about another provider
You can use the same method on any other provider out there as long as they have rescue system. Eg. OVH (SYS, Kimsufi), Hetzner, Leaseweb, etc.
DigitalOcean seems have a recovery ISO and perhaps you can install Windows on their VPS lineup. Let me know if you managed to install Windows on DigitalOcean.