How to create Cloud-Init Kali template in Proxmox
How to create Cloud-Init Kali template in Proxmox
How to create Cloud-Init Kali template in Proxmox
Tutorial
Prepare img file
- You need to have installed 7z:
1
apt install -y libguestfs-tools p7zip-full
- Download file into
/var/lib/vz/template/iso/withwget:1
wget https://cdimage.kali.org/kali-2024.4/kali-linux-2024.4-vmware-amd64.7z -o /var/lib/vz/template/iso/kali-linux-2024.4-vmware-amd64.7z && cd /var/lib/vz/template/iso/
- Extract downloaded files:
1
7z x kali-linux-2024.4-vmware-amd64.7z
- Convert image
VMDKintoRAW:1
qemu-img convert -f vmdk -O raw kali-linux-2024.4-vmware-amd64.vmwarevm/kali-linux-2024.4-vmware-amd64.vmdk kali-2024.4.img
- We can customize our
RAWimg file thanks tolibquestfs-tools:- Install
cloud-init:1
virt-customize -a kali-2024.4.img --install cloud-init
- Install
qemu-guest-agent&spice-vdagent:1 2
virt-customize -a kali-2024.4.img --install qemu-guest-agent virt-customize -a kali-2024.4.img --install spice-vdagent
- (Optional) Enable SSH, It’s disabled by default:
1
virt-customize -a kali-2024.4.img --run-command 'systemctl enable ssh.service'
- Enable Cloud-Init, It’s also disabled by default
1
virt-customize -a kali-2024.4.img --run-command 'systemctl enable cloud-init-main'
- Update your image: it’s gonna take a while …
1
virt-customize -a kali-2024.4.img --update
- Install
- We’ve got prepared file
kali-2024.4.img
Prepare Proxmox TEMPLATE
- Create empty template:
1
qm create 9000 --memory 4096 --net0 virtio,bridge=vmbr0 --scsihw virtio-scsi-pci
vmbr0Can be different, depends on your network devices…
- Import our prepared img file
kali-2024.4.imgto our template:1
qm set 9000 --scsi0 local-zfs:0,import-from=/var/lib/vz/template/iso/kali-2024.4.img
local-zfsCan be different, depends on your Proxmox installation.
- Add cloud-init disk:
1
qm set 9000 --ide2 local-zfs:cloudinit
local-zfsCan be different, depends on your Proxmox installation.
- Define boot order:
1
qm set 9000 --boot c --bootdisk scsi0
- OPTIONAL: Add ability to serial socket for Console
xterm.js1
qm set 9000 --serial0 socket --vga serial0
- Convert VM into template
1
qm template 9000
Now you are able to clone from Template, and before start the VM you can set Cloud-Init variables…
Some additional info
- User
kali/kaliwill remains… - This article was tested on
Proxmox 8.2.7 - You can check
cloud-initbycloud-init status
Sources
This post is licensed under CC BY 4.0 by the author.
