Dismiss Notice
Hey Guest! We'd like to know what you think of our new theme & platform, click here to share your thoughts!
  1. NewEraCracker

    NewEraCracker New Member Member

    May 22, 2010
    1,335
    Sources:
    Preparation | Winstaller.org | Install your own windows on a OVH server.
    Qemu in rescue system, e.g. Windows installation
    Please note I am not affiliated with above sites and I am only sharing this useful information. Do it at your own risk.

    Requirements
    The server needs to have at least 16GB of RAM and a processor that supports VT (Example: Intel i5).

    Preparation

    NOTE: ALL drives will be wiped during install process so backup needed data!

    1. Install a Linux OS like Debian. Other distro’s should work but Debian has been tried and tested.
    2. Deactivate monitoring on your server as it interferes with the change of OS. To do this, go into your OVH manager and:
      • Select your server
      • Click on Server Status
      • Click on Monitoring
      • Click Deactivate Monitoring
    3. Enter Rescue Pro mode:
      • Click on Services
      • Click on Netboot
      • Select Rescue PRO mode
      • Reboot (either through the OS or through the manager)
      • Wait for Rescue Pro Mode email with logins.
      • Go back to netboot and change it back to “HD” (DO NOT REBOOT THIS TIME!!)

    The process:

    [update6]updated due to experience with Win7 installation on core i5-3570[/update6]
    [update5]Thanks Peter Littmann, updated as suggested in Post 23[/update5]

    Here my two cents for installing windows and other operating systems with qemu-kvm

    Booting the rescue systems gives you a complete linux system that is running on your server without using your hard disk.

    [First get the network data of your server: ifconfig and save network data like IP, gateway, mac, etc.]
    Not needed. Kimsufi/OVH has DHCP, so your server will work right away. But you will need to turn of "monitoring" in your control panel, since Windows normally does not respond to ping!

    #to see if Raid devices are present and stop them
    cat /proc/mdstat
    mdadm --stop /dev/md0
    mdadm --stop /dev/md1

    #Second step is to get rid of the network drives, because they are read-only
    mount -t tmpfs -o size=12000m tmpfs /mnt # use 12GB of memory as temp - reduce as needed

    mkdir /mnt/var
    mkdir /mnt/var/cache
    mkdir /mnt/var/lib
    mkdir /mnt/var/run
    mkdir /mnt/usr
    mkdir /mnt/lib

    rsync -a /var/cache/ /mnt/var/cache/
    rsync -a /var/lib/ /mnt/var/lib/
    rsync -a /var/run/ /mnt/var/run/
    rsync -a /usr/ /mnt/usr/
    rsync -a /lib/ /mnt/lib/

    mount -B /mnt/var/cache /var/cache
    mount -B /mnt/var/lib /var/lib
    mount -B /mnt/var/run /var/run
    mount -B /mnt/usr /usr
    #Now our linux system is running of our RAM.

    #download windows iso into /mnt
    cd /mnt
    wget http://domain.tld/yourwindows.iso #adjust as necessary

    #Get qemu, you can also install virtualbox or vmware player and do the installation with that, but mounting physical harddisk is a little bit more complicated.
    apt-get update
    apt-get upgrade
    apt-get install qemu # take over 200MB
    apt-get install kvm # You need that, since qemu does not work without virtualization with windows 7 or server 2k8

    #Wipe hard disks, so that Windows DVD start installation
    dd if=/dev/zero of=/dev/sda bs=1M count=1
    dd if=/dev/zero of=/dev/sdb bs=1M count=1

    #with the following command you can reread the partition. that is needed if you want to mount a partition in linux later on, to copy data from the rescue system to windows or back.
    partprobe

    #NOT RECOMMENDED!! If you need direct network, setup ethernet bridge in your host system before and TAP device, to grant access to internet for Qemu through new TAP device.
    #apt-get install bridge-utils
    #apt-get install systemtap
    #sysctl net.ipv4.ip_forward=1
    #ip link set eth0 up promisc on
    #brctl addbr br0
    #brctl addif br0 eth0 #you will need to make a script with this, because activating this line will cut the ssh connection and you will not be able to reconnect.

    #Now use qemu. "qemu" is 32-bit, "qemu-system-x86_64" is 64 bit
    #I guess Window XP would work without kvm, but Windows 7, Windows 2k8 and so on don't, due to a bug in qemu, that is there for years. [update2] N.B. There seems to be a problem with qemu and windows Qemu in rescue system, e.g. Windows installation - Page 2 You may need to switch to kvm.[/update2]

    qemu-system-x86_64 -net nic -net user,hostfwd=tcp::3389-:3389 -m 1.5G -alt-grab -localtime -enable-kvm -cpu kvm64,+nx -usbdevice tablet -k en-us -cdrom /mnt/yourwindows.iso -hda /dev/sda -hdb /dev/sdb -vnc :0

    -cpu (CPU Type) # host for use host type CPU - good when using kvm
    -enable-kvm # if kvm installed, use kvm
    -smp # number of processors
    -vnc :0 # means use vncdisplay 0 -> ":0"=5900 port, ":1"=5901 port, etc)
    -m # amount of memory, 2048 can cause problems
    -usbdevice # useful with VNC
    -k # keyboard format needs to be used, if you use keyboard other than en-us
    -cdrom # image file
    -hda # first hdd -> using physical HDD
    -hdb # second hdd -> using physical HDD
    -boot # if you need to boot from another drive e.g. /cdrom
    -boot once=d # boot once from different drive.

    This should get Windows installation up and running. While installing choose custom partition for first hdd and leave the second hdd empty. Finish installation. Setup a user name with password. Activate remote desktop for that user and update windows. You should be having internet behind nat. We are forwarding port 3389, so you can try if remote desktop is working. It should. If everything is as you want, you can go on to the tricky part, which you can read about in the second post.

    On your client machine you can use the following command to tunnel vnc through ssh to safely access your headless qemu session

    vncviewer -via root@yourip localhost:0

    -via (login to your server through ssh, using user root and standard ssh port)
    -localhost:0 (ssh makes remote server be localhost for you, :0 means connecting to port 5900 on remote server, :1 would mean connecting through port 5901, etc)

    Okay, once your system is up and running in qemu-kvm and you did all the updates, you will come into problems, when you reboot the system outside qemu-kvm. The reason for that is the ethernet card that is different and the hard disk controller that don't match. You could for sure do something manually about it, but in the internet they recommend to use the MS tool sysprep, which was installed with my Windows 7 Pro installation.

    The idea is so to speak, to make the necessary adjustments, so that Windows has no problem booting in a new environment. Sysprep puts Windows into the state that it will recheck the hardware and reconfigure basic settings, like timezone, keyboard language, etc. The problem is only, that you are not sitting in front of the PC to answer those questions. That is why you have to create an "unattend.xml" file. To create that file you need to download Windows AIK from here Download The Windows® Automated Installation Kit (AIK) for Windows® 7 from Official Microsoft Download Center (this is the version for Windows 7 and Server 2k8 and maybe other versions too). Install it to any Windows system you like.

    You will need the file CDROM:\sources\install_(windows version you used).clg from your Windows DVD.

    I used this legal Windows 7 Pro english http://msft.digitalrivercontent.net/win/X17-24281.iso DVD to create this unattend.xml file, you can get on pastebin unattend.xml - Pastebin.com .

    When you start the program "Windows System Image Manager" you can use that unattend.xml to get you started. You will need to mount the "install_xxxx.clg" file with a right mouse click under "Select a Windows image or catalog file".

    Then follow the tutorials in the links above and google to see, which values to select for your unattend.xml file.

    Once you have an unattend.xml file that corresponds to your Windows installation you are ready to restart. Copy the unattend.xml file to c:\windows\panther and c:\windows\system32\sysprep and change dir to c:\windows\system32\sysprep and execute

    Sysprep /generalize /oobe /shutdown /unattend:unattend.xml

    The computer will shut down then. In Kimsufi Manager switch to boot from harddisk and restart.

    Your server should reboot and you should be able to use remote desktop to log into your server.

    Under Linux you can use

    rdesktop 123.234.123.234 # to connect to your server

    See result of successful installation
    Image Upper.com - Free Image Hosting - View Image
    Image Upper.com - Free Image Hosting - View Image

    Some further comments:

    Since sysprep puts windows in a state to recheck the available hardware, you can easily make a backup/clone of the partitions to another hard disk / server. I guess, that is what other people do, when they offer their services. They have an image, they only need to copy onto the new server and when it boots, Windows autoconfigures itself and ready you are.

    There are backup programs that do V2P or restore to dissimilar hardware. Those programs can easily be used to restore a Windows or Windows Server through a Linux rescue. You can run those programs in qemu-kvm.

    I would recommend for Windows versions the freeware ToDo Backup 3.5. It is not the latest version, but it is free.

    One last thing is still missing, setting up Raid 1.
    When you connect to the "diskmgmt.msc" disk management program you can select with right click on disk0 and disk1 and choose convert to dynamic disk. Once both disks are dynamic disks, you can first choose "system reserve" and with right click choose add mirror. Repeat the same for all other partitions. This way you get Soft-Raid 1 on Windows.

    Links I used:
    Chapter*13.*Running Virtual Machines with qemu-kvm
    QEMU Emulator User Documentation
    Tip: How to run a headless guest machine using VNC with KVM | KVM - The Linux Kernel-Based Virtual Machine
    Mdadm Cheat Sheet - MDLog:/sysadmin
    The Complete Guide to Preparing a Windows 7 Deployment Image using Audit Mode and Sysprep with an unattend.xml Answer File | Sybaspot
    Building an Unattended Answer File for Windows 7 | Me, Myself and IT
    Chapter*13.*Running Virtual Machines with qemu-kvm
    Windows 7 Installation - Transfer to a New Computer - Windows 7 Help Forums

    Other notes:
    If you want to install Windows Server 2008 R2 instead of Windows 7 Pro: Qemu in rescue system, e.g. Windows installation - Page 6
     
    Last edited: Mar 9, 2014
  2. ThumperTM

    ThumperTM Well-Known Member Member

    Jan 4, 2011
    1,821
    Thanks!:]
     
  3. arshidkv12

    arshidkv12 New Member Member

    Nov 8, 2013
    67
    Thanks ..
     
  4. zarvis

    zarvis New Member Member

    Apr 30, 2013
    23
    great tutorial
     
  5. inject0r

    inject0r New Member Member

    Jul 13, 2011
    1,666
    pretty good, do you know if OVH checks if you have a valid win license or a cracked?
     
  6. NewEraCracker

    NewEraCracker New Member Member

    May 22, 2010
    1,335
    I don't think they check windows license installed. As long as you use a proper activation method there should be no problem. Personally I either use a legit MSDN serial or a KMS tool to activate it.
     
  7. emil0072

    emil0072 New Member Member

    Jan 30, 2012
    91
    Any one can help me install win on KS server? I will pay 15-20 usd. Please contact with me
     
  8. ThumperTM

    ThumperTM Well-Known Member Member

    Jan 4, 2011
    1,821
  9. 8cores

    8cores New Member Member

    Aug 26, 2013
    227
    Thanks, very helpful!
     

Share This Page