debian-vm-auto-setup/virt-customize_method/init.sh

16 lines
529 B
Bash
Raw Normal View History

#!/usr/bin/sh
base="$(pwd)"
mkdir -p vm
cd vm
wget -N https://cloud.debian.org/images/cloud/bookworm/latest/debian-12-generic-amd64.qcow2
virt-customize \
--add ./debian-12-generic-amd64.qcow2 \
--root-password password:root \
--hostname "sandbox05" \
--firstboot-install "procps,psmisc,vim,net-tools,curl,dnsutils,file,tmux" \
--copy-in "$base/netplan:/etc" \
--copy-in "$base/.ssh:/root" \
--firstboot-command 'netplan apply && ssh-keygen -A && systemctl restart sshd'