Skip to content
ProHomeLab
RU

Proxmox

Installing and Configuring a Cloud-Init Image in Proxmox

Stilicho2011Updated 3 min read18 views

Also available in: RU

Installing and Configuring a Cloud-Init Image in Proxmox
Part 3 of 10 in the series Proxmox
  1. Setting Up SSL Certificates in Proxmox with the Built-in ACME
  2. Setting Up Templates and Linked Clones in Proxmox VE
  3. Installing and Configuring a Cloud-Init Image in Proxmox
  4. Upgrading from Proxmox VE 8 to Proxmox VE 9 - A Step-by-Step Guide
  5. Proxmox SDN Guide - VXLAN, VLAN, and Virtual Networks Setup
  6. How to Set Up a Firewall in Proxmox VE - Step-by-Step Guide
  7. Why I Don't Need Ceph Storage in Proxmox for My Home Server
  8. Proxmox Cluster - Setup, QDevice, and Mixed Hardware in Nodes
  9. Storage for HA in a Proxmox Cluster
  10. How to Merge local-lvm and local into a Single Storage in Proxmox
Contents

If you liked this article, you can support the author by becoming a sponsor on Boosty (link in the contacts section).

What is Cloud-Init and why do you need it?

Cloud-Init is a tool for automating the initial setup of virtual machines. It allows you to automatically configure:

  • the hostname,
  • network interfaces,
  • users and passwords,
  • SSH keys,
  • scripts that run on first boot.

Combined with Proxmox VE, Cloud-Init helps quickly deploy identical VMs with minimal manual effort. It's especially useful in homelab environments, where deployment speed and reproducibility matter.


Tasks solved with Cloud-Init images

  1. Automation. Removes the need to manually configure each new VM.
  2. Standardization. All machines are deployed from a single standard template.
  3. Security. You can set SSH keys right away and disable the root password.
  4. Scalability. Ideal for deploying dozens of VMs in a cluster. Of course, that's unlikely to be needed at home, but if you need it at work, you can practice on test subjects first.
  5. CI/CD compatibility. Images can be used for automated testing and infrastructure delivery. But, as I said above, for home use it's more of a testing ground.

In Proxmox VE 8, Cloud-Init is integrated at the GUI and CLI level, which greatly simplifies the process.

How to install a Cloud-Init image in Proxmox

In the video, I show how to do all of this using the graphical interface. Personally, I think it's much more convenient, but below I provide the instructions as described in the Proxmox documentation on their website. The instructions on the site are functional, but somewhat outdated. They use an Ubuntu image from way back in 2016 as an example.

Step 1. Download the official Cloud-Init image

Go to cloud-images.ubuntu.com or a similar resource. For example:

yaml
wget https://cloud-images.ubuntu.com/noble/current/noble-server-cloudimg-amd64.img

Step 2. Import the image into Proxmox

yaml
# create a new VM with VirtIO SCSI controller
qm create 9000 --memory 2048 --net0 virtio,bridge=vmbr0 --scsihw virtio-scsi-pci
yaml
# import the downloaded disk to the local-lvm storage, attaching it as a SCSI drive
qm set 9000 --scsi0 local-lvm:0,import-from=/path/to/noble-server-cloudimg-amd64.img

Step 3. Add the Cloud-Init image as a CD-ROM drive

The next step is to configure the CD-ROM drive that will be used to install Cloud-Init on the virtual machine.

yaml
qm set 9000 --ide2 local-lvm:cloudinit

To be able to boot directly from the Cloud-Init image, set the boot order to order=scsi0, so the BIOS only boots from this disk. This speeds up boot time because the VM's BIOS skips checking for a bootable CD-ROM.

yaml
qm set 9000 --boot order=scsi0

Many Cloud-Init images require configuring a serial console and using it as the display. If this configuration doesn't suit a particular image, revert to the default display.

yaml
qm set 9000 --serial0 socket --vga serial0

And as the final step, convert our virtual machine into a template.

yaml
qm template 9000

That's it, the template is ready. From here you can freely create full clones from this template and work with them.

Network features in Proxmox VE 8

Proxmox VE 8 uses systemd-networkd, so it's important to set the network parameters correctly:

If you leave DHCP enabled, Cloud-Init will automatically obtain an IP.

For a static IP, fill in the IP Address, Gateway, and DNS fields on the Cloud-Init tab.

Commands used in the video

Download the image

yaml
wget https://cloud-images.ubuntu.com/noble/current/noble-server-cloudimg-amd64.img

Rename the image

yaml
mv noble-server-cloudimg-amd64.img noble-server-cloudimg-amd64.qcow2

Set up the serial console on the virtual machine we need

yaml
qm set 700 --serial0 socket --vga serial0

Set the working size of the VM's cloud-init disk

yaml
qemu-img resize noble-server-cloudimg-amd64.qcow2 32G

Import the cloud-init image into the virtual machine

yaml
qm disk import 700 noble-server-cloudimg-amd64.qcow2 local

Conclusion

Installing a Cloud-Init image in Proxmox VE significantly simplifies infrastructure deployment. Proper image preparation and Cloud-Init configuration allow you to fully automate the VM configuration process, which is especially relevant for DevOps and corporate environments, but of course it can also be used in a homelab.

The logical next step, once you've customized a VM like this to your liking (packages, users, network settings), is to save it as a template so you don't have to repeat the whole setup from scratch next time. I cover how to do that in my article on templates and linked clones in Proxmox.