-
Notifications
You must be signed in to change notification settings - Fork 1
/
qemu.cheat
40 lines (34 loc) · 1.15 KB
/
qemu.cheat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
% qemu, pushou
# create disk
qemu-img create -f qcow2 <DISK_NAME>.img <DISK_SIZE>
# create vm (macos hvf)
qemu-system-x86_64
-m 2048 \
-vga virtio \
-display cocoa,show-cursor=on \
-usb \
-device usb-tablet \
-drive file=./ubuntu-22.04-amd64.qcow2,if=virtio \
-device e1000,netdev=net0 \
-netdev user,id=net0,hostfwd=tcp::10022-:22 \
-accel hvf \
-cpu Penryn,vendor=GenuineIntel
# create windows vm Linux
virt-install \
--name Windows_11 \
--ram 8096 \
--disk path=/var/lib/libvirt/images/Windows_11.img,size=60 \
--cpu host-passthrough \
--vcpus=4 \
--os-variant=win10 \
--network bridge=virbr0 \
--graphics vnc,listen=0.0.0.0,password=password \
--video virtio \
--cdrom /home/pouchou/quickemu/windows-11/Win11_22H2_French_x64v1.iso \
--features kvm_hidden=on,smm=on \
--tpm backend.type=emulator,backend.version=2.0,model=tpm-tis \
--boot loader=/usr/share/OVMF/OVMF_CODE.secboot.fd,loader_ro=yes,loader_type=pflash,nvram_template=/usr/share/OVMF/OVMF_VARS.ms.fd
# qemu convert vmdk to qcow2
qemu-img convert -p -f vmdk -O qcow2 packer-debian-11-amd64-disk001.vmdk debian11-ova.qcow2
# virt-sparsify
sudo virt-sparsify debian11-ova.qcow2 --compress debian11.qcow2