Skip to content

Instantly share code, notes, and snippets.

@aaronedev
Last active July 4, 2025 09:50
Show Gist options
  • Save aaronedev/9dda8b92cdd4e56e40544ac286a56579 to your computer and use it in GitHub Desktop.
Save aaronedev/9dda8b92cdd4e56e40544ac286a56579 to your computer and use it in GitHub Desktop.
run kali os from local directory with qemu
#!/bin/bash
# https://www.kali.org/get-kali/#kali-virtual-machines
# qemu-kali.sh — boots kali-linux-2025.2-qemu-amd64.qcow2 from the local mir directory
IMG="kali-linux-2025.2-qemu-amd64.qcow2"
IMG_PATH="./mir/$IMG"
RAM="24G"
VRAM="1G"
# sanity check
if [ ! -f "$IMG_PATH" ]; then
echo "Error: Kali image not found at $IMG_PATH"
echo "Make sure you've got $IMG in your mir/ directory!!!"
exit 1
fi
qemu-system-x86_64 \
-enable-kvm \
-machine q35 \
-smp 4 \
-m $RAM \
-cpu host \
-net nic,model=virtio \
-net user,hostfwd=tcp::2222-:22 \
-device virtio-vga-gl,hostmem=$VRAM,blob=true,venus=true \
-vga none \
-display gtk,gl=on,show-cursor=on \
-usb -device usb-tablet \
-object memory-backend-memfd,id=mem1,size=$RAM \
-machine memory-backend=mem1 \
-hda "$IMG_PATH"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment