Ubuntu autoinstall

HowTo
https://canonical-subiquity.readthedocs-hosted.com/en/latest/tutorial/providing-autoinstall.html#providing-autoinstall

Download Ubuntu iso
https://releases.ubuntu.com/24.04/ubuntu-24.04-desktop-amd64.iso

wget https://releases.ubuntu.com/24.04/ubuntu-24.04-desktop-amd64.iso -O ~/Downloads/iso/ubuntu-24.04-desktop-amd64.iso

Prepare

sudo apt install qemu-system-x86
 
# mount ISO by double click
#sudo mount -r ~/Downloads/iso/ubuntu-24.04-desktop-amd64.iso /mnt

autoinstall.yaml

cat <<EOF> autoinstall.yaml
#cloud-config
autoinstall:
  version: 1
  locale: en_US.UTF-8
  keyboard:
    layout: de
  identity:
    hostname: u2104
    username: root
    password: "$6$exDY1mhS4KUYCE/2$zmn9ToZwTKLhCw.b4/b.ZRTIZM30JZ4QrOQ2aOXJ8yk96xpcCof0kxKwuX1kqLG/ygbJ1f8wxED22bTL4F46P0" # ubuntu
  ssh:
    install-server: yes
    allow-pw: no
    # authorized-keys:
    #   - "ssh-rsa xxxxxxxxxx foo-key"
  apt:
    geoip: true
  # storage:
  #   layout:
  #     name: lvm
  late-commands:
    - curtin in-target --target=/target -- apt update
    - curtin in-target --target=/target -- apt upgrade -y
    - curtin in-target --target=/target -- apt autoremove -y
    - curtin in-target --target=/target -- ssh-import-id-gh panticz
EOF
#touch meta-data
touch vendor-data
 
# start webserver
python3 -m http.server 3003

VM

# create
truncate -s 10G image.img
kvm -m 4096 \
  -drive file=image.img,format=raw,cache=none,if=virtio \
  -cdrom ~/Downloads/iso/ubuntu-24.04-desktop-amd64.iso \
  -kernel "/media/${USER}/Ubuntu 24.04 LTS amd64/casper/vmlinuz" \
  -initrd "/media/${USER}/Ubuntu 24.04 LTS amd64/casper/initrd" \
  -append 'autoinstall cloud-config-url=http://_gateway:3003/autoinstall.yaml'
 
#  -append 'autoinstall ds=nocloud-net;s=http://_gateway:3003/'
# allow access to bridgte
sudo mkdir /etc/qemu
echo "allow lxdbr0" | sudo tee /etc/qemu/bridge.conf
 
# start VM connected to bridge lxdbr0
sudo kvm -m 1024 \
  -drive file=image.img,format=raw,cache=none,if=virtio \
  -device virtio-net-pci,netdev=net0 \
  -netdev bridge,id=net0,br=lxdbr0
 
# get VM IP
nmap -sP 192.168.1.*

Cubic
https://github.com/PJ-Singh-001/Cubic
https://derlinuxwikinger.de/automatische-ubuntu-installation-mit-autoinstall/

apt-add-repository ppa:cubic-wizard/release
apt update
apt install cubic
 
rm -f image.img && truncate -s 10G image.img && kvm -no-reboot -m 4096     -drive file=image.img,format=raw,cache=none,if=virtio     -cdrom ubuntu-24.04.0-autoinstall-desktop-amd64.iso

Links
https://canonical-subiquity.readthedocs-hosted.com/en/latest/reference/autoinstall-reference.html
https://linuxconfig.org/how-to-write-and-perform-ubuntu-unattended-installations-with-autoinstall
https://github.com/canonical/autoinstall-desktop/blob/main/autoinstall.yaml
https://github.com/canonical/autoinstall-desktop/blob/main/README.md
https://blog.local-optimum.net/getting-started-with-autoinstall-on-ubuntu-desktop-24-04-lts-147a1defb2de
https://canonical-subiquity.readthedocs-hosted.com/en/latest/howto/autoinstall-quickstart.html
https://ubuntu.com/server/docs/install/autoinstall-quickstart
https://github.com/canonical/subiquity/tree/main/examples/autoinstall
https://ubuntu.com/server/docs/install/autoinstall-reference
https://ubuntu.com/server/docs/install/autoinstall-schema
https://cloudinit.readthedocs.io/en/latest/topics/modules.html
https://curtin.readthedocs.io/en/latest/
https://docs.cloud-init.io/en/latest/reference/datasources/nocloud.html#method-4-local-filesystem