Cloud Images - churchers/vm-bhyve GitHub Wiki

Using Cloud Images

You can use cloud images to create virtual machines. The vm img command will download the image to datastore and uncompress it if needed (.xz, .tar.gz, and .gz files are supported). The image should be in RAW or QCOW2 format. To use this feature you'll need install qemu or qemu-devel package:

pkg install qemu

To launch FreeBSD using official cloud image:

vm img https://download.freebsd.org/ftp/releases/VM-IMAGES/14.0-RELEASE/amd64/Latest/FreeBSD-14.0-RELEASE-amd64.raw.xz
vm create -t freebsd-zvol -i FreeBSD-14.0-RELEASE-amd64.raw freebsd-cloud
vm start freebsd-cloud

Using cloud-init

vm-bhyve has basic support for providing cloud-init configuration to the guest. You can enable it with -C option to vm create command. You can also pass public SSH key to be injected into the guest with option -k <file>. To use cloud-init install cdrkit-genisoimage package:

pkg install cdrkit-genisoimage

Example:

vm img https://cloud-images.ubuntu.com/noble/current/noble-server-cloudimg-amd64.img
vm create -t ubuntu-cloud -i noble-server-cloudimg-amd64.img -C -k ~/.ssh/id_rsa.pub ubuntu-server
vm start ubuntu-server
Starting ubuntu-server
* found guest in /zroot/vm/ubuntu-server
* booting...
ssh [email protected]
The authenticity of host '192.168.0.91 (192.168.0.91)' can't be established.
ECDSA key fingerprint is SHA256:6s9uReyhsIXRv0dVRcBCKMHtY0kDYRV7zbM7ot6u604.
No matching host key fingerprint found in DNS.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.0.91' (ECDSA) to the list of known hosts.
Welcome to Ubuntu 24.04.1 LTS (GNU/Linux 6.8.0-45-generic x86_64)

Ubuntu cloud sample conf file

# ➜  .templates cat ubuntu-cloud.conf
loader="uefi"
uefi_vars="yes"
cpu=4
memory=4096M
network0_type="virtio-net"
network0_switch="public"
graphics="yes"
xhci_mouse="yes"
graphics_res="1600x900"
zfs_zvol_opts="volblocksize=128k"
disk0_name="disk0"
disk0_dev="sparse-zvol"
disk0_type="virtio-blk"
⚠️ **GitHub.com Fallback** ⚠️