sudo apt-get install virt-manager libvirt-daemon ovmf cloud-image-utils libslirp-dev nbdkit nbdfuse fuse2fs ninja-build meson pkg-config libglib2.0-dev libpixman-1-dev flex bison
Download from https://www.qemu.org/download
cd qemu_dir
./configure --enable-slirp
make -j`nproc`
sudo make install
https://developer.hashicorp.com/packer/downloads
git clone https://github.com/canonical/packer-maas
cd packer-maas/ubuntu/
vim ubuntu-cloudimg.pkr.hcl and change the -machine to "pc,accel=kvm" in qemuargs
cloud-localds seeds-cloudimg.iso user-data-cloudimg meta-data
packer init .
To add ssh keys or preserve your /etc/apt/sources.list, you might want to make changes like I have here:
#cloud-config
users:
- name: root
lock_passwd: false
hashed_passwd: "<your_hashed_password"
ssh_redirect_user: false
ssh_import_id:
- lp:mckeesh
ssh_pwauth: True
disable_root: false
preserve_hostname: true
apt:
preserve_sources_list: true
runcmd:
- sed -i -e '/^[#]*PermitRootLogin/s/^.*$/PermitRootLogin yes/' /etc/ssh/sshd_config
- systemctl restart ssh
PACKER_LOG=1 packer build -var ubuntu_series=jammy -only='cloudimg.*' .
PACKER_LOG=1 packer build -var kernel=linux-image-generic -var ubuntu_series=lunar -only='cloudimg.*' .
PACKER_LOG=1 packer build -var customize_script=custom-script.sh -var ubuntu_series=lunar -only='cloudimg.*' .
make custom-cloudimg.tar.gz
tar xvf custom-cloudimg.tar.gz -C image_contents
Edit image_contents/etc/cloud/cloud.cfg and add the following line:
apt_preserve_sources_list: true
gzip -d custom-cloudimg.tar.gz
pushd image_contents
tar -uf ../custom-cloudimg.tar etc/cloud/cloud.cfg
popd
gzip custom-cloudimg.tar
Step 1: Get admin access to your MAAS server
Step 2: maas login <username> <MAAS URL>
Step 2.5: In the MAAS UI, click <username> -> API keys to get your API key to log in with
Step 3: maas your_username boot-resources create name='whatever_imagename_identifier' title='Image Display Name' architecture='amd64/generic' filetype='tgz' content@=custom-cloudimg.tar.gz
i think you could use md suffix to make markdown rendering