added minimal image

This commit is contained in:
ston1th 2021-09-18 21:07:42 +02:00
commit 41dda70d6b

View file

@ -68,3 +68,45 @@ Even more cleanup:
apt -y purge lshw lsof ltrace man-db manpages mdadm mtr-tiny screen sosreport strace tcpdump tmux usbutils whiptail apt -y purge lshw lsof ltrace man-db manpages mdadm mtr-tiny screen sosreport strace tcpdump tmux usbutils whiptail
apt -y autoremove apt -y autoremove
``` ```
## Minimal Cloud Image
```
curl -sSL https://cloud-images.ubuntu.com/minimal/releases/bionic/release/ubuntu-18.04-minimal-cloudimg-amd64.img >/tmp/ubuntu-18.04-minimal-cloudimg-amd64.img
cat <<'EOF'> /var/lib/vz/snippets/9001_bootstrap
#cloud-config
package_update: true
package_upgrade: true
ntp:
enabled: true
servers: ["pool.ntp.org"]
ssh_deletekeys: true
ssh_genkeytypes: ["ed25519", "rsa"]
runcmd:
- "apt-get -y purge apport htop lxcfs lxd lxd-client motd-news-config mdadm os-prober sosreport"
- "apt-get -y autoremove --purge"
- "apt-get -y clean"
- "bash -c 'rm /home/ubuntu/.ssh/authorized_keys; exit 0'"
- "bash -c 'find /var/log -type f | while read f; do echo -ne >$f; done; exit 0'"
- "bash -c 'rm -rf /var/lib/cloud/*; exit 0'"
power_state:
mode: poweroff
EOF
qm destroy 9001
qm create 9001 --memory 2048 --net0 virtio,bridge=vmbr0
qm importdisk 9001 /tmp/ubuntu-18.04-minimal-cloudimg-amd64.img local
qm set 9001 --scsihw virtio-scsi-pci --scsi0 local:9001/vm-9001-disk-0.raw
qm set 9001 --ide0 local:cloudinit
qm set 9001 --boot c --bootdisk scsi0
qm set 9001 --serial0 socket --vga serial0
qm set 9001 --cicustom "user=local:snippets/9001_bootstrap"
qm set 9001 --ipconfig0 ip=dhcp,ip6=dhcp
qm start 9001
sleep 10;while :; do qm status 9001|grep -q stopped && break; done
qm set 9001 --cicustom ""
qm set 9001 --ipconfig0 ""
qm template 9001
```