Create qcow image

  1. qemu-img create -f qcow2 myimage.img 2G

Install system on image

  1. qemu-system-x86_64 -cdrom ubuntu-20.04.2-live-server-amd64.iso -m 1024 -hda ubuntu_20_04_server_amd64.img

Run system

  1. qemu-system-x86_64 -m 1024 -hda ubuntu_20_04_server_amd64.img

Run system with port forward

  1. qemu-system-x86_64 -m 1024 -hda ubuntu_20_04_server_amd64.img -net user,hostfwd=tcp::2222-:22 -net nic

forward virtual host’s 22 to localhost 2222 port
-net nic which set basic network for virtual host.