Running VM's

In order to run Linux, we use the bhyve hypervisor on HardenedBSD for running virtual machines with Debian.

Manual deployment

Up until now, creating a VM and managing it has been done by hand, using vm-bhyve (vm(8)). The manual dance goes something like this.

Download an ISO image to boot from (once):

vm iso https://ftp.acc.umu.se/debian-cd/current/amd64/iso-cd/debian-10.3.0-amd64-netinst.iso

Verify it:

curl -s https://ftp.acc.umu.se/debian-cd/current/amd64/iso-cd/SHA512SUMS | egrep -q ^$(sha512 -q /var/jail/_vm/.iso/debian-10.3.0-amd64-netinst.iso) || echo BAD IMAGE FILE

Create a VM, install it "by hand":

vm create -t debian NAME
vm install NAME debian-10.3.0-amd64-netinst.iso
vm console NAME
# installing debian

Make sure the new VM autostarts:

sysrc vm_list+=NAME

Automated deployment

Table of Contents

We are now looking into automating the creation of VM's. Current notes below.

  • cloud-init configuration support in vm(8)

    • vm create -C
    • vm create -k id_rsa.pub
    • apt show cloud-init Cloud-init provides a framework and tool to configure and customize virtual machine instances for Infrastructure-as-a-Service (IaaS) clouds platforms. It can for example set a default locale and hostname, generate SSH private host keys, install SSH public keys for logging into a default account, set up ephemeral mount points, and run user-provided scripts. . Various methods are supported for passing data to the instance at launch time, including the standard interfaces of multiple platforms.
  • is chyves something to consider, instead of vm(8)?

  • what about libvirt?