How can I install Windows 7 without dvd or usb, on linux?

77,474

Solution 1

Method 2016. First of all, you need to create a partition for Windows installation files. It should be 2gb bigger than Windows iso.

  • Install a tool, that help you install Windows directly from the hard drive:

    sudo add-apt-repository ppa:nilarimogard/webupd8
    sudo apt update
    sudo apt install winusb
    
  • Install a tool for work with NTFS:

    sudo apt-get install ntfs-3g
    
  • Format partition in NTFS:

    sudo mkfs.ntfs /dev/sdxx
    
  • Copy installation files to partition:

    sudo winusb --install iso_name /dev/sdxx
    
  • Reboot and you will be able to install Windows.

Update:

winusb is deprecated now, use woeusb instead. Type woeusb --help for more information.

Solution 2

If you're comfortable doing it, you might be able to create a small partition on your hard drive, extract the Windows ISO contents to it, then install it from there.

I found a thread about how to do it from within Windows, but it shouldn't be too hard to do it in Linux: http://www.neowin.net/forum/topic/1093625-trying-to-install-windows-8-consumer-preview-but-no-dvd-burner/ (though it doesn't look like they ever did figure out how to get it working, it looks like a good place to start)

But it would probably be easier just to purchase a bigger USB drive :)

Solution 3

If you are familiar with grub, try the first way.

Install with Windows PE

  1. Make a windows partition with NFS as filesystem, put your Windows Install Image there.
  2. Download an Windows PE image with virtual cd-rom software to some where your grub can access.
  3. Boot the Windows PE with grub, load your Windows Install Image and install it.
  4. Fix your grub.

Install with help of another computer

  1. Install windows on another computer
  2. Run C:\Windows\System32\sysprep.exe and reboot into a live linux
  3. Make a image of drive C with dd of some other tool on linux
  4. Restore the image to the active partition of your computer on your linux
  5. Update your grub.cfg to boot that partition, If you are using ubuntu, you can use sudo update-grub to update your grub.cfg automatically.

Solution 4

Another easy way to install Windows in Linux is to start a VM. You have to pass the installtion target device block (for example /dev/sda) to VM and of course the windows installer.

Here a simple script you can change to fit your purpose:

#!/bin/bash

function run_vm {

qemu-system-x86_64 \
-name windows-os-install \
-m 4G \
-no-reboot \
-cpu host \
-smp 12,sockets=1,cores=12,threads=1 \
-boot d \
-drive file=/dev/sda,media=disk,driver=raw \
-drive file=/home/<user>/documents/isos/Win10_1909_x64.iso,media=cdrom &

}

run_vm
wait

After installation (windows attempts a reboot, but due to no-reboot the VM does not reboot), you may now reboot to the real drive and continue the installation there.

Share:
77,474

Related videos on Youtube

Umair
Author by

Umair

Updated on September 18, 2022

Comments

  • Umair
    Umair over 1 year

    I have a different problem that I don't think can be solved but it's better to ask before loosing all hope.

    I currently run Crunchbang (Debian dist) and would like to install Windows 7 as well. However, my computer don't have a dvd-reader and all my usb-drives are too small.

    Is my only solution to this problem to buy a larger usb-drive?

    • cdlvcdlv
      cdlvcdlv almost 6 years
      In the end, what did you do?
    • Umair
      Umair almost 6 years
      @cdlvcdlv now this was 6 years ago, I don't remember what I did in the end. Probably just got a bigger USB. But the answer below does sound like a solution in case you don't have access to a larger USB stick.
    • cdlvcdlv
      cdlvcdlv almost 6 years
      I supposed you'd say something like that but I had to try... I have Endless OS right now and I cannot use apt commands. I tried several USB boot makers but my W7 DVD won't boot on UEFI when installed on USB (it stop with error about winload.efi and that). Well, thanks anyway.
  • Umair
    Umair almost 12 years
    Yeah, another computer is not a solution for me either. I know that usb sticks are cheap but I rather not buy something that I only use once. And also, almost no stores are open in Spain on sundays...
  • Umair
    Umair almost 12 years
    Sounds like a possible solution to me. I will try something similar tomorrow. Thanks!
  • davidtbernal
    davidtbernal almost 12 years
    This will probably work but take some fiddling :).
  • Umair
    Umair over 7 years
    Huh, not that I still have this problem, but this definitely sounds like the best solution! Thanks for answering!
  • vuhung3990
    vuhung3990 about 6 years
    update woeusb: sudo woeusb -d ~/Downloads/filename.iso /dev/sdb
  • cdlvcdlv
    cdlvcdlv almost 6 years
    Any way to install woeusb on Endless OS? apt commands aren't available.
  • Umair
    Umair almost 6 years
    @cdlvcdlv you could always build it from source: github.com/slacka/WoeUSB#build-from-source
  • cdlvcdlv
    cdlvcdlv almost 6 years
    @VictorBjelkholm Just to build dependencies you need apt-get, dpkg, etc: sudo apt-get install devscripts equivs gdebi-core. I'm not even sure you can use gcc.
  • apoplexy
    apoplexy over 3 years
    Thanks, this helped me! Used woeusb as described above, but when I tried to boot from the from the UEFI menu I got a message that the disk was not bootable even though I had the boot flag enabled for the partition. When I changed the flag to esp it worked! (esp - This flag indicates an UEFI System Partition. GPT uses this flag as an alias for "boot". The UEFI firmware stores files on this partition)