Install homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Install QEMU and other required packages:
brew install qemu
Download iso
wget https://cdimage.debian.org/debian-cd/current/amd64/iso-cd/debian-11.7.0-amd64-netinst.iso
Create a disk image for the debian server
qemu-img create -f qcow2 debian-11.7.0-amd64-netinst.qcow2 20G
Install server
qemu-system-x86_64 -hda debian-11.7.0-amd64-netinst.qcow2 -boot d -cdrom debian-11.7.0-amd64-netinst.iso -m 2048
Run server
qemu-system-x86_64 -hda debian-11.7.0-amd64-netinst.qcow2 -m 2048
To access SSH, you must run qemu with port forwarding args
Now you can SSH from macos: