| Beide Seiten der vorigen Revision
Vorhergehende Überarbeitung
Nächste Überarbeitung
|
Vorhergehende Überarbeitung
|
cloud-init-templates [2023/01/11 22:11] jochen |
cloud-init-templates [2023/01/11 22:18] (aktuell) jochen |
| |
| in das NFS-Share wechseln | in das NFS-Share wechseln |
| cd /mnt/pve/Install-Images/template/iso/ | root@pvet3:~# cd /mnt/pve/Install-Images/template/iso/ |
| |
| |
| Download des cloud-init-Images | Download des cloud-init-Images |
| wget https://cloud-images.ubuntu.com/releases/22.04/release/ubuntu-22.04-server-cloudimg-amd64.img | root@pvet3:/mnt/pve/Install-Images/template/iso# wget https://cloud-images.ubuntu.com/releases/22.04/release/ubuntu-22.04-server-cloudimg-amd64.img |
| |
| Erstellen einer VM | Erstellen einer VM |
| qm create 8000 --memory 2048 --core 2 --name ubuntu-cloud-template --net0 virtio,bridge=vmbr0 | root@pvet3:/mnt/pve/Install-Images/template/iso# qm create 8000 --memory 2048 --core 2 --name ubuntu-cloud-template --net0 virtio,bridge=vmbr0 |
| |
| Importieren des cloud init-Images in die VM | Importieren des cloud init-Images in die VM |
| <code> | <code> |
| qm importdisk 8000 ubuntu-22.04-server-cloudimg-amd64.img Install-Images | root@pvet3:/mnt/pve/Install-Images/template/iso# qm importdisk 8000 ubuntu-22.04-server-cloudimg-amd64.img Install-Images |
| importing disk 'ubuntu-22.04-server-cloudimg-amd64.img' to VM 8000 ... | importing disk 'ubuntu-22.04-server-cloudimg-amd64.img' to VM 8000 ... |
| Formatting '/mnt/pve/Install-Images/images/8000/vm-8000-disk-0.raw', fmt=raw size=2361393152 preallocation=off | Formatting '/mnt/pve/Install-Images/images/8000/vm-8000-disk-0.raw', fmt=raw size=2361393152 preallocation=off |
| |
| SCSI-Controller zuweisen | SCSI-Controller zuweisen |
| qm set 8000 --scsihw virtio-scsi-pci --scsi0 Install-Images:8000/vm-8000-disk-0.raw | root@pvet3:/mnt/pve/Install-Images/template/iso# qm set 8000 --scsihw virtio-scsi-pci --scsi0 Install-Images:8000/vm-8000-disk-0.raw |
| update VM 8000: -scsi0 Install-Images:8000/vm-8000-disk-0.raw -scsihw virtio-scsi-pci | update VM 8000: -scsi0 Install-Images:8000/vm-8000-disk-0.raw -scsihw virtio-scsi-pci |
| |
| Anlegen der cloud init-Partition | Anlegen der cloud init-Partition |
| qm set 8000 --ide2 Install-Images:cloudinit | root@pvet3:/mnt/pve/Install-Images/template/iso# qm set 8000 --ide2 Install-Images:cloudinit |
| update VM 8000: -ide2 Install-Images:cloudinit | update VM 8000: -ide2 Install-Images:cloudinit |
| Formatting '/mnt/pve/Install-Images/images/8000/vm-8000-cloudinit.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off preallocation=metadata compression_type=zlib size=4194304 lazy_refcounts=off refcount_bits=16 | Formatting '/mnt/pve/Install-Images/images/8000/vm-8000-cloudinit.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off preallocation=metadata compression_type=zlib size=4194304 lazy_refcounts=off refcount_bits=16 |
| |
| Bootdevice festlegen | Bootdevice festlegen |
| qm set 8000 --boot c --bootdisk scsi0 | root@pvet3:/mnt/pve/Install-Images/template/iso# qm set 8000 --boot c --bootdisk scsi0 |
| update VM 8000: -boot c -bootdisk scsi0 | update VM 8000: -boot c -bootdisk scsi0 |
| |
| Serielle Console hinzufügen | Serielle Console hinzufügen |
| qm set 8000 --serial0 socket --vga serial0 | root@pvet3:/mnt/pve/Install-Images/template/iso# qm set 8000 --serial0 socket --vga serial0 |
| update VM 8000: -serial0 socket -vga serial0 | update VM 8000: -serial0 socket -vga serial0 |
| |
| Qemu-Guest-Agent und fstrim aktivieren | Qemu-Guest-Agent und fstrim aktivieren |
| qm set 8000 --agent enabled=1,fstrim_cloned_disks=1,type=virtio | root@pvet3:/mnt/pve/Install-Images/template/iso# qm set 8000 --agent enabled=1,fstrim_cloned_disks=1,type=virtio |
| update VM 8001: -agent enabled=1,fstrim_cloned_disks=1,type=virtio | update VM 8001: -agent enabled=1,fstrim_cloned_disks=1,type=virtio |
| |
| Neue Größe der virt. HDD festlegen | Neue Größe der virt. HDD festlegen |
| qm disk resize 8000 scsi0 10G | root@pvet3:/mnt/pve/Install-Images/template/iso# qm disk resize 8000 scsi0 10G |
| Image resized. | Image resized. |
| |
| VM in Template umwandeln | VM in Template umwandeln |
| qm template 8000 | root@pvet3:/mnt/pve/Install-Images/template/iso# qm template 8000 |
| |
| folgende Fehlermeldung erschien bei NFS-Storage | folgende Fehlermeldung erschien bei NFS-Storage |
| /usr/bin/chattr: Operation not supported while reading flags on /mnt/pve/Install-Images/images/8000/base-8000-disk-0.raw | /usr/bin/chattr: Operation not supported while reading flags on /mnt/pve/Install-Images/images/8000/base-8000-disk-0.raw |
| command '/usr/bin/chattr +i /mnt/pve/Install-Images/images/8000/base-8000-disk-0.raw' failed: exit code 1 | command '/usr/bin/chattr +i /mnt/pve/Install-Images/images/8000/base-8000-disk-0.raw' failed: exit code 1 |