Simple guide for installing debian12 on qemu.

Requirements:

(assuming you have qemu installed on your system if not refer to qemu-wiki here https://www.qemu.org/download/ )

step1:

Download the iso image from the debians server.
ISO
Note: Don't go for the images where there is a gui as they tend be bloated and are slow to run on vm. instead chose the standard debian img without any gui.

step2:

  1. Create a folder with any name you want here we are creating one with name deb:
    (this is done in order keep everything together in one folder)
    $mkdir deb
    $cd deb
  2. Once you are in the folder make the virtual drive on which we will install debian.
    $qemu-img create -f qcow2 disk.qcow 32g

step3:

run the command:
$qemu-system-x86_64 -m 4096 -smp 2 -cdrom ../isos/debian-live-12.2.0-amd64-standard.iso -drive if=virtio,file=disk.qcow2,format=qcow2

step4:

To run your newly made vm run the command
$qemu-system-x86_64 -m 4096 -smp 2 -drive if=virtio,file=disk.qcow2,format=qcow2 -netdev user,id=mynet0,hostfwd=tcp:127.0.0.1:7922-:22 -device virtio-net,netdev=mynet0
this is the way you can run the newly created vm in gui format
To run vm in headless form just add the flag '-display none -daemonize' to the command and you can acess the vm on port 7922 (assuming the guest os has a ssh server already running).