Code:
#! /bin/sh
# NOTE: the bios ROM path should be configured when you installed ovmf
kvm\
-enable-kvm\
-bios /usr/share/qemu/OVMF.fd\
-drive format=raw,media=cdrom,file=mydistro.iso\
-hdb /dev/sdz\
-m 4096\
-smp cores=4\
-net nic\
-net user
Quick explanation:
-enable-kvm
This allows Type 1 hypervisor, which is very simply put, sends the instructions from the VM to your CPU instead of emulating it. If you have problems, you may need to enable KVM and IOMMU in your host machine's BIOS.
-bios /usr/share/qemu/OVMF.fd
The path to the BIOS ROM your VM will use instead of the standard one, which does not support the plethora of UEFI extensions that OVMF does.
-drive format=raw,media=cdrom,file=mydistro.iso
This just adds a drive, a "CD-ROM" (DVD as well), with the ISO "mydistro.iso" (the one you're installing) inside the "tray".
-hdb /dev/sdz
Assign a host storage device node as a physical storage device in the VM. Range: hda, hdb, hdc, ... and so on. "hda" is in use here, so we use hdb.
-m 4096
Memory (RAM) allocated in MB.
-smp cores=4
Number of logical cores to use (you may call them "threads") to give your VM. Do not overtax the host (your PC), it's better to let the VM run slower. General safe rule if give the VM half your logical cores, but really, you should check your host's resource use. The installation also won't benefit much, if any, from over 4 cores. If you were using it for something else, then I'd stick to the 50/50 split.
-net nic
Enable access to your host primary/default network interface. You can use options to further fiddle with this.
-net user
Plain English: setup a virtual DHCP server with the VM's own subnet and NAT to give the guest machine access to your host's network and the internet.
\
Means a newline that continues the one above in a shell.