mallory.computer

HOWTO: Install FreeBSD, NetBSD, OpenBSD using vm-bhyve

This HOWTO will present the steps of installing FreeBSD, NetBSD, and OpenBSD guests on a FreeBSD host using vm-bhyve. I'll assume sysutils/vm-bhyve is already installed and configured. See man vm for configuration instructions.

% uname -srm
FreeBSD 14.2-RELEASE-p1 amd64

% vm version
vm-bhyve: Bhyve virtual machine management v1.6-devel (rev. 106001)

If you're using the console subcommand and you don't see anything, try pressing return. Also, note that there is no way to exit the console subcommand. You may need to close the terminal you are using entirely when you're done using it.

Installing FreeBSD on FreeBSD

  1. Download the latest disc image.

    vm iso https://download.freebsd.org/releases/amd64/amd64/ISO-IMAGES/14.2/FreeBSD-14.2-RELEASE-amd64-disc1.iso
  2. Create an empty VM.

    vm create -t default freebsd00
  3. Start the VM using the installation image.

    vm install freebsd00 FreeBSD-14.2-RELEASE-amd64-disc1.iso
  4. Connect to the console of the VM.

    vm console freebsd00
  5. Proceed with the installation. The default options should work.

Configuration as seen with vm configure freebsd00:

loader="bhyveload"
cpu=1
memory=256M
network0_type="virtio-net"
network0_switch="public"
disk0_type="virtio-blk"
disk0_name="disk0.img"
uuid="1275e62d-e09c-496c-b4a7-6da2fd0e06f0"
network0_mac="58:9c:fc:0a:59:e9"

Installing NetBSD on FreeBSD

  1. Download the latest disc image.

    vm iso https://cdn.netbsd.org/pub/NetBSD/NetBSD-10.1/images/NetBSD-10.1-amd64.iso
  2. Create an empty VM using the pre-installed NetBSD template.

    vm create -t netbsd netbsd00
  3. Start the VM using the installation image.

    vm install netbsd00 NetBSD-10.1-amd64.iso
  4. Connect to the console of the VM.

    vm console netbsd00
  5. Proceed with the installation. The default options should work.

Configuration as seen with vm configure netbsd00:

loader="grub"
cpu=1
memory=256M
network0_type="virtio-net"
network0_switch="public"
disk0_type="virtio-blk"
disk0_name="disk0.img"
grub_install0="knetbsd -h -r cd0a /netbsd"
grub_run0="knetbsd -h -r dk0 /netbsd"
uuid="a525c553-c17f-46fc-95cd-535501038ff0"
network0_mac="58:9c:fc:0f:25:9e"

Installing OpenBSD on FreeBSD

  1. Download the latest disc image.

    vm iso https://cdn.openbsd.org/pub/OpenBSD/7.7/amd64/install77.iso
  2. Create an empty VM using the pre-installed OpenBSD template.

    vm create -t openbsd openbsd00
  3. Edit the configuration.

    vm configure openbsd00

    On the grub_install0 line, change 6.2 to 7.7.

  4. Start the VM using the installation image.

    vm install openbsd00 install77.iso
  5. Connect to the console of the VM.

    vm console openbsd00
  6. Proceed with the installation. The default options should work aside from:

    • When installing to disk, use MBR instead of the default GPT.
    • When asked to change the default console to com0, ensure you choose yes (this is the default).

Configuration as seen with vm configure openbsd00:

loader="grub"
cpu=1
memory=256M
network0_type="virtio-net"
network0_switch="public"
disk0_type="virtio-blk"
disk0_name="disk0.img"
grub_install0="kopenbsd -h com0 /7.7/amd64/bsd.rd"
grub_run0="kopenbsd -h com0 -r sd0a /bsd"
bhyve_options="-w"
uuid="02bd7294-3cfa-4ef2-ade9-f9d4546b544c"
network0_mac="58:9c:fc:00:83:f8"