Tags: cloudstack,howto,ubuntu,almalinux,oraclelinux,debian
Date: 20241023
Most distributions nowadays offer for download prepackaged images - most often in Qcow2 format - that you can use with your favourite virtualisation tool.
These images come with cloud-init and tend to work out of the box with CloudStack, but not to their full potential, for example password resets would not work on them.
# Step 1 - create a config file for cloud-init that is more Cloudstack friendly - do note I enable root user/login here
cat << "EOF" > 99_cloudstack.cfg
disable_root: 0
system_info:
default_user:
name: root
ssh_pwauth: true
datasource_list: ['CloudStack']
cloud_config_modules:
- [set-passwords, always]
- [ssh, always]
EOF
# Step 2 - download the required files - adjust as needed
wget https://yum.oracle.com/templates/OracleLinux/OL9/u4/x86_64/OL9U4_x86_64-kvm-b234.qcow2 \
https://repo.almalinux.org/almalinux/9/cloud/x86_64/images/AlmaLinux-9-GenericCloud-latest.x86_64.qcow2 \
https://saimei.ftp.acc.umu.se/images/cloud/bookworm/latest/debian-12-generic-amd64.qcow2 \
https://cloud-images.ubuntu.com/noble/current/noble-server-cloudimg-amd64.img
# Step 3 - copy the cloud-init config snippet inside the images, we'll use the Alma image as an example,
# but you could use a bash loop and apply it to all
virt-copy-in -a ./AlmaLinux-9-GenericCloud-latest.x86_64.qcow2 99_cloudstack.cfg /etc/cloud/cloud.cfg.d/
# Step 3.1 - it looks like Oracle and Alma Linux 9 (possibly other versions and other clones, too) are lacking "wget" in the image,
# so we need to install it, otherwise the Cloudstack password feature will not work as the cloud-init CloudStack source relies on it.
virt-customize -a ./AlmaLinux-9-GenericCloud-latest.x86_64.qcow2 --install wget
|