Virtual Machine Setup
Download the debian-12-generic-amd64.raw
file from https://cloud.debian.org/images/cloud/bookworm/latest/.
- Create the virtaul machine
- Add a cloud-init drive on the VM
- Import the cloud image:
qm importdisk $VMID /mnt/pve/assets/template/iso/debian-12-generic-amd64.raw local-lvm --format qcow2
- Setup cloud-init:
qm set $VMID --cicustom "user=cloud-init:snippets/user.yaml,network=cloud-init:snippets/network.yaml"
Example config files:
user.yaml
#cloud-config
hostname: zsottvXX
manage_etc_hosts: true
fqdn: zsottvXX.zsnet.ca
user: zsadmin
ssh_authorized_keys:
- ssh-rsa KEY COMMENT
chpasswd:
expire: False
users:
- default
# Setup ntp
ntp:
enabled: true
ntp_client: chrony
servers: []
pools:
- time.zsnet.ca
# Add gnupg
bootcmd:
- DEBIAN_FRONTEND=noninteractive apt-get -yq update
- DEBIAN_FRONTEND=noninteractive apt-get -yq install gnupg
# Configure apt repositories
apt:
primary:
- arches: [default]
uri: http://mirror.csclub.uwaterloo.ca/debian/
security:
- arches: [default]
uri: http://mirror.csclub.uwaterloo.ca/debian-security/
sources_list: |
deb $PRIMARY $RELEASE main contrib
deb $PRIMARY $RELEASE-updates main contrib
deb $SECURITY $RELEASE-security main contrib
package_update: true
package_upgrade: true
package_reboot_if_required: true
# Install packages
packages:
- qemu-guest-agent
network.yaml
version: 1
config:
- type: physical
name: eth0
mac_address: 'xx:yy:zz:aa:bb:cc'
subnets:
- type: dhcp4
- type: ipv6_slaac
- type: nameserver
address:
- '2602:815:9000::53'
- '2602:815:9000:1::53'
search:
- 'zsnet.ca'