樹心幽徑

« 20190312製作HBCD_PE_x64.iso及antiX-17.4_x64-full.iso開機隨身碟 | Main | 20190314用php程式加入一筆資料到ms-access2000資料庫檔(selldb.accdb)的goods資料表中 (b2.php) »

20190311在windows裝qemu
2019/03/14,10:57

REF:http://jamyy.us.to/blog/2013/07/5104.html

 

(1)下載qemu-w64-setup-20181127.exe (100M QEMU Installer for Windows 64 bit)並執行之

(2)下載 HBCD_PE_x64.iso (Hiren’s BootCD PE x64 v1.0.1 約1.3GB)

(3)執行 qemu-system-x86_64 -cdrom HBCD_PE_x64.iso -boot d -m 4096

 

Part II:建立XP虛擬機

[作業系統] WIN XP SP3 繁體中文原版 ISO 下載WINXP_SP3_TW.iso (604.6 MB) 

(4)建立xp虛擬硬碟檔 $

$ qemu-img create -f qcow2 xp.img 10G
Formatting 'xp.img', fmt=qcow2 size=10737418240 cluster_size=65536 lazy_refcounts=off refcount_bits=16

(5)建立xp安裝光碟的iso檔: $ dd if=/dev/cdrom of=xp.iso bs=2048 conv=sync,notrunc

[treehrt@sice ~]$ dd if=/dev/cdrom of=xp.iso bs=2048 conv=sync,notrunc
309216+0 records in
309216+0 records out
633274368 bytes (633 MB, 604 MiB) copied, 131.905 s, 4.8 MB/s


(6)用xp安裝光碟iso檔(xp.iso)將WINDOWS XP 裝在xp虛擬硬碟檔(xp.img)中:

$ qemu-system-i386 -enable-kvm -drive file=xp.img,format=qcow2 -m 2G  -cdrom xp.iso

 qemu-system-i386 -enable-kvm -drive file=xp.img,format=qcow2 -m 2G -net bridge,br=br0 -net nic,model=virtio

(6-2)

$ dd if=/dev/zero of=mapsource.img count=950000 bs=1KiB
950000+0 records in
950000+0 records out
972800000 bytes (973 MB, 928 MiB) copied, 24.9261 s, 39.0 MB/s

$ losetup --show -f mapsource.img
losetup: cannot find an unused loop device
[treehrt@sice xp]$ sudo losetup --show -f mapsource.img
[sudo] password for treehrt:
/dev/loop0

$ sudo parted /dev/loop0 -s mklabel gpt mkpart EFI FAT16 1MiB 100% toggle 1 boot
[treehrt@sice xp]$ sudo mkfs -t msdos /dev/loop0p1
mkfs.fat 4.1 (2017-01-24)

 

$ sudo mount /dev/loop0p1 mapsource

:

$ sudo cp garmin/MapSource6_11_3CHT.exe mapsource

$ sudo cp MapSrcSerial.unl mapsource

$ sudo cp -R Dakota mapsource

[treehrt@sice xp]$ sudo umount /dev/loop0p1

(6-3)

$ qemu-system-i386 -enable-kvm -drive file=xp.img,format=qcow2 -m 2G -drive if=ide,format=raw,file=mapsource.img  -net bridge,br=br0 -net nic,model=virtio -net nic,model=rtl8139

順利上網成功

 

(6-4) 掛第2顆硬碟:

REF:http://www.suares.com/index.php?page_id=25&news_id=209

$qemu-img create -f raw dsk2.raw 4G

$ sudo losetup /dev/loop0 dsk2.raw

$ sudo fdisk -u /dev/loop0

:

命令 (m 以獲得說明):p
Disk /dev/loop0: 4 GiB, 4294967296 bytes, 8388608 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x0d9b4703

命令 (m 以獲得說明):n
Partition type
   p   primary (0 primary, 0 extended, 4 free)
   e   extended (container for logical partitions)
Select (default p): p
分割區編號 (1-4, default 1):
First sector (2048-8388607, default 2048):
Last sector, +sectors or +size{K,M,G,T,P} (2048-8388607, default 8388607):

Created a new partition 1 of type 'Linux' and of size 4 GiB.

命令 (m 以獲得說明):t

Hex code (type L to list all codes): 86
Changed type of partition 'Linux' to 'NTFS volume set'.

命令 (m 以獲得說明):w

:

$ sudo losetup -d /dev/loop0

$ qemu-img convert -f raw dsk2.raw -O qcow dsk2.img

$ qemu-system-i386 -enable-kvm -drive file=xp.img,format=qcow2 -m 2G -hdd dsk2.img -net bridge,br=br0 -net nic,model=virtio -net nic,model=rtl8139

 

(6-5) 拷入mapsource

$ sudo losetup --show -f dsk2.raw
/dev/loop0

$  sudo mkfs -t msdos /dev/loop0
mkfs.fat 4.1 (2017-01-24)
[treehrt@sice xp]$  sudo mount /dev/loop0 mapsource

:

$ sudo cp -r garmin/bin mapsource/

$ sudo cp -r garmin/*.unl mapsource/

$ sudo cp -r garmin/MapSource6_11_3CHT.exe mapsource/

:

$ ls mapsource/
bin  MapSource6_11_3CHT.exe  MapSrcSerial.unl

$  sudo umount /dev/loop0

$ sudo losetup -d /dev/loop0

$ qemu-system-i386 -enable-kvm -drive file=xp.img,format=qcow2 -m 2G -hdd dsk2.img (沒成功)

(6-6)

$ dd if=/dev/cdrom of=vb6.iso bs=2048 conv=sync,notrunc
284424+0 records in
284424+0 records out
582500352 bytes (583 MB, 556 MiB) copied, 123.741 s, 4.7 MB/s

$ qemu-system-i386 -enable-kvm -drive file=xp.img,format=qcow2 -m 2G -cdrom vb6.iso -net bridge,br=br0 -net nic,model=virtio -net nic,model=rtl8139


alt

 

Part III:建立win7虛擬機

(8)建立win7虛擬硬碟檔:
$ qemu-img create -f qcow2 win7.img 20G
Formatting 'win7.img', fmt=qcow2 size=21474836480 encryption=off cluster_size=65536 lazy_refcounts=off

(9)建立win7安裝光碟的iso檔:

$ dd if=/dev/cdrom of=win7.iso bs=2048 conv=sync,notrunc
1754432+0 records in
1754432+0 records out
3593076736 bytes (3.6 GB) copied, 642.98 s, 5.6 MB/s

(10)用win7安裝光碟iso檔(win7.iso)將WINDOWS 7 裝在win7虛擬硬碟檔(win7.img)中:

$ qemu-system-x86_64 -enable-kvm -drive file=win7.img,format=qcow2 -m 1G  -cdrom win7.iso

Part V:建立fedora 28虛擬機

$ qemu-img create -f qcow2 fc28.img 20G
Formatting 'fc28.img', fmt=qcow2 size=21474836480 encryption=off cluster_size=65536 lazy_refcounts=off

$ qemu-system-x86_64 -enable-kvm -drive file=fc28.img,format=qcow2 -m 1G  -cdrom Fedora-Server-netinst-x86_64-28-1.1.iso

 

迴響

 
Accessible and Valid XHTML 1.0 Strict and CSS Powered by LifeType