Skip to content

Instantly share code, notes, and snippets.

@ogaida
Last active March 23, 2025 11:02
Show Gist options
  • Save ogaida/807a830f38c0c6d526f4467cf4012795 to your computer and use it in GitHub Desktop.
Save ogaida/807a830f38c0c6d526f4467cf4012795 to your computer and use it in GitHub Desktop.

Download and start the newest cirrOS without cloudinit in a libvirt environment

use only for testing, not for production. cirrOS was made for testing cloud environments.

apt install guestfish -y
version=$(curl -s https://download.cirros-cloud.net/version/released)
wget https://download.cirros-cloud.net/${version}/cirros-${version}-x86_64-disk.img -O cirrOS.qcow2
name=cirros-${version}
osname=$(virt-install --osinfo list|grep -i cirros|head -1)
nohup sudo virt-install \
   --connect=qemu:///system \
   --name $name \
   --memory 512 \
   --osinfo=$osname \
   --vcpus=1 \
   --disk path=cirrOS.qcow2,bus=virtio,size=1 \
   --graphics vnc \
   --network bridge=virbr0,model=virtio \
   --boot hd \
   --import > /dev/null &
sleep 5
virsh destroy $name
guestfish -a cirrOS.qcow2 --rw -i write /etc/cirros-init/config 'DATASOURCE_LIST="nocloud"'
virsh start $name
virsh console $name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment