Proxmox Debian Cloud-Init Template
This guide will walk you through the process of creating a Debian Bookworm cloud-init template in Proxmox, allowing for quick and easy deployment of customized Debian VMs.
Prerequisites
- Proxmox VE 7.0 or later
- Internet connection on the Proxmox host
Steps
- Download Debian Bookworm cloud image:
wget https://cloud.debian.org/images/cloud/bookworm/latest/debian-12-generic-amd64.qcow2
- Create a new VM:
qm create 9000 --memory 2048 --cores 2 --name debian-cloud --net0 virtio,bridge=vmbr0
- Import the disk to local-lvm storage:
qm importdisk 9000 debian-12-generic-amd64.qcow2 local-lvm
- Attach the new disk to the VM as scsi0:
qm set 9000 --scsihw virtio-scsi-pci --scsi0 local-lvm:vm-9000-disk-0
- Add cloud-init drive:
qm set 9000 --ide2 local-lvm:cloudinit
- Make the cloud-init drive bootable and restrict BIOS to boot from disk only:
qm set 9000 --boot c --bootdisk scsi0
- Add serial console:
qm set 9000 --serial0 socket --vga serial0
- Enable QEMU guest agent:
qm set 9000 --agent enabled=1
- Configure cloud-init:
qm set 9000 --ciuser your_username
qm set 9000 --cipassword your_password
qm set 9000 --sshkeys ~/.ssh/id_rsa.pub
Replace your_username
, your_password
, and the SSH key path with your desired values.
- Configure network to use DHCP:
qm set 9000 --ipconfig0 ip=dhcp
- Convert the VM to a template:
qm template 9000
Using the Template
To create a new VM from this template:
- Go to the Proxmox web interface
- Select "Create VM"
- Choose "From Template" and select your newly created template
- Adjust any settings as needed
- Finish the creation process
Your new VM will be created with the predefined settings and cloud-init configuration.
Conclusion
You now have a Debian Bookworm cloud-init template in Proxmox. This template allows you to quickly deploy customized Debian VMs with pre-configured settings, saving time and ensuring consistency across your virtual machines.