Skip to main content
  1. Posts/
  2. Proxmox/

Installing and Configuring a Cloud-Init Image in Proxmox

··649 words·4 mins· loading · loading · ·
Stilicho2011
Author
Stilicho2011
Writing about homelab, self-hosting, automation and open-source solutions
Table of Contents
Proxmox - This article is part of a series.
Part : This Article

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:

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

Step 2. Import the image into Proxmox
#

# create a new VM with VirtIO SCSI controller
qm create 9000 --memory 2048 --net0 virtio,bridge=vmbr0 --scsihw virtio-scsi-pci
# 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.

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.

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.

qm set 9000 --serial0 socket --vga serial0

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

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

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

Rename the image

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

Set up the serial console on the virtual machine we need

qm set 700 --serial0 socket --vga serial0

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

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

Import the cloud-init image into the virtual machine

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.

Proxmox - This article is part of a series.
Part : This Article

Related