The Debian GNU/Linux cloud images can conveniently be used out of the box with the following:
$ wget -O debian.qcow2 https://cloud.debian.org/images/cloud/buster/20201214-484/debian-10-generic-amd64-20201214-484.qcow2
$ virt-sysprep -a debian.qcow2 --run-command 'dpkg-reconfigure --frontend=noninteractive openssh-server' --ssh-inject debian:file:$HOME/.ssh/id_rsa.pub
$ virt-install --connect qemu:///system --boot hd --name debian --memory 1024 --vcpus 1 --cpu host --disk path=$(pwd)/debian.qcow2,bus=virtio,format=qcow2 --os-type=linux --os-variant=debian10 --graphics vnc --noautoconsole
$ virsh --connect qemu:///system domifaddr debian
Name MAC address Protocol Address
-------------------------------------------------------------------------------
vnet0 52:54:00:3e:6f:1a ipv4 192.168.122.84/24
$ ssh debian@192.168.122.84 df -h /
Filesystem Size Used Avail Use% Mounted on
/dev/vda1 1.9G 1.3G 481M 73% /
$ wget -O debian.qcow2 https://cloud.debian.org/images/cloud/buster/20201214-484/debian-10-generic-amd64-20201214-484.qcow2
$ virt-sysprep -a debian.qcow2 --run-command 'dpkg-reconfigure --frontend=noninteractive openssh-server' --ssh-inject debian:file:$HOME/.ssh/id_rsa.pub
$ virt-install --connect qemu:///system --boot hd --name debian --memory 1024 --vcpus 1 --cpu host --disk path=$(pwd)/debian.qcow2,bus=virtio,format=qcow2 --os-type=linux --os-variant=debian10 --graphics vnc --noautoconsole
$ virsh --connect qemu:///system domifaddr debian
Name MAC address Protocol Address
-------------------------------------------------------------------------------
vnet0 52:54:00:3e:6f:1a ipv4 192.168.122.84/24
$ ssh debian@192.168.122.84 df -h /
Filesystem Size Used Avail Use% Mounted on
/dev/vda1 1.9G 1.3G 481M 73% /
However, 2GB for the root file system may not be enough: virt-resize and virt-rescue should be used to expand it.
Continue reading “virt-resize applied to Debian GNU/Linux cloud images”