Skip to content

Instantly share code, notes, and snippets.

@plembo
Last active August 29, 2022 14:40
Show Gist options
  • Save plembo/03af2f8f39558c3d8644ea6ea2e4acac to your computer and use it in GitHub Desktop.
Save plembo/03af2f8f39558c3d8644ea6ea2e4acac to your computer and use it in GitHub Desktop.
Creating a KVM Linux guest from the console

Creating a KVM Linux guest from the console

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment