How to Create a Debian 11 Cloud VM on Proxmox Using Cloud-Init


How to Create a Debian 11 Cloud VM on Proxmox Using Cloud-Init

Creating cloud-init enabled virtual machines is a great way to automate deployments, especially when working in cloud hosting or development environments. In this guide, we’ll show you how to create a Debian 11 VM on Proxmox using the qm command line interface.

We’ll cover how to:

  • Import a Debian 11 cloud image
  • Attach and configure cloud-init
  • Assign a static IP
  • Boot the VM automatically on system startup

Let’s dive in.


🧰 Prerequisites

Ensure you have:

  • A Proxmox VE node set up
  • Storage pool named local-lvm
  • Network bridge (e.g., vmbr0)
  • Internet access to download the Debian image

🖼️ Step 1: Download Debian 11 Cloud Image

wget https://cloud.debian.org/images/cloud/bullseye/latest/debian-11-genericcloud-amd64.qcow2 -P /var/lib/vz/template/iso/

This downloads the official Debian 11 generic cloud image and stores it in your ISO template directory.


🆕 Step 2: Create the VM

qm create 4001 --name debian-vm --memory 1024 --cores 1 --net0 virtio,bridge=vmbr0
  • 4001 is the VM ID
  • debian-vm is the VM name
  • 1024 MB RAM and 1 CPU core
  • vmbr0 is the bridge interface for networking

💽 Step 3: Import the Cloud Image Disk

qm importdisk 4001 /var/lib/vz/template/iso/debian-11-genericcloud-amd64.qcow2 local-lvm

This imports the disk into your local-lvm storage and attaches it to the VM.


🧩 Step 4: Attach and Resize the Disk

qm set 4001 --scsihw virtio-scsi-pci --scsi0 local-lvm:vm-4001-disk-0
qm resize 4001 scsi0 20G
  • Sets the disk interface as SCSI
  • Resizes the VM disk to 20GB

☁️ Step 5: Add Cloud-Init Drive

qm set 4001 --ide2 local-lvm:cloudinit

Cloud-Init allows you to configure the instance at first boot (like user credentials and networking).


🌐 Step 6: Configure Network and Credentials

qm set 4001 --ipconfig0 ip=103.0.113.50/24,gw=103.0.113.1
qm set 4001 --ciuser devuser --cipassword DevPass123
qm set 4001 --searchdomain cloudhost.com
  • Assigns a static IP address
  • Creates a user (devuser) with password
  • Sets DNS search domain

🔧 Step 7: Boot Configuration

qm set 4001 --boot c --bootdisk scsi0
qm set 4001 --onboot 1
qm set 4001 --boot order=scsi0

This ensures the VM boots from the disk and starts automatically on Proxmox boot.


▶️ Step 8: Start and Check VM

qm start 4001
qm status 4001

Your Debian 11 VM should now be up and running!


Conclusion

Using Proxmox and Cloud-Init makes deploying pre-configured virtual machines easy and efficient. You can extend this setup by injecting SSH keys, running initialization scripts, or automating the whole process with Ansible or shell scripts.

Leave a Comment