Example uses Ubuntu 18.04 LTS.
Get console on KVM (libvirtd) host and execute virt-install command:
virt-install \
--name test01 \
--ram 1024 \
--disk pool=default,size=8,bus=virtio,format=qcow2 \
--vcpus 1 \
--os-type linux \
--os-variant ubuntu18.04 \
--network network:default \
--graphics none \
--console pty,target_type=serial \
--location 'http://archive.ubuntu.com/ubuntu/dists/bionic/main/installer-amd64/' \
--extra-args 'console=ttyS0,115200n8 serial' \
--force --debug
Notes:
Use "--graphics", "--console" and "--extra-args" options to establish connection via serial console. Must use "--location" rather than --cdrom as "--extra-args" not available with the latter.
References:
Fabian Lee, KVM: Creating an Ubuntu VM with console-only access. 2018.