Last active
October 3, 2023 10:37
-
-
Save Elektordi/13bfc4de77ee03fed208142565ef2b9d to your computer and use it in GitHub Desktop.
Import Debian Cloudimage in Proxmox
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
url=https://cloud.debian.org/images/cloud/bookworm/latest/debian-12-generic-amd64.qcow2 | |
nextid=$(( `qm list | cut -c 1-10 | tr -d ' ' | sort -gr | head -n 1` + 1 )) | |
if (( $nextid < 9000 )); then | |
nextid=9000 | |
fi | |
file=`basename $url` | |
cd /tmp | |
wget $url | |
qm create $nextid --memory 2048 --net0 virtio,bridge=vmbr1 | |
qm set $nextid --name `echo $file | cut -d . -f 1` | |
qm importdisk $nextid $file local-lvm | |
rm $file | |
qm set $nextid --scsihw virtio-scsi-pci --scsi0 local-lvm:vm-$nextid-disk-0 | |
qm set $nextid --ide2 data:cloudinit | |
qm set $nextid --boot c --bootdisk scsi0 | |
qm set $nextid --serial0 socket --vga serial0 | |
qm set $nextid --ide2 local-lvm:cloudinit | |
qm set $nextid --boot c --bootdisk scsi0 | |
qm set $nextid --serial0 socket --vga serial0 | |
qm template $nextid |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment