Skip to content

Quickstart

Mateusz Piotrowski edited this page Sep 17, 2017 · 7 revisions

A simple overview of the commands needed to install vm-bhyve and start a FreeBSD guest.

1. pkg install vm-bhyve [grub2-bhyve uefi-edk2-bhyve]
2. zfs create pool/vm
3. echo 'vm_enable="YES"' >> /etc/rc.conf
4. echo 'vm_dir="zfs:pool/vm"' >> /etc/rc.conf
5. vm init
6. cp /usr/local/share/examples/vm-bhyve/* /mountpoint/for/pool/vm/.templates/
7. vm switch create public
8. vm switch add public em0
9. vm iso ftp://ftp.freebsd.org/pub/FreeBSD/releases/ISO-IMAGES/10.3/FreeBSD-10.3-RELEASE-amd64-bootonly.iso
10. vm create myguest
11. vm [-f] install myguest FreeBSD-10.3-RELEASE-amd64-bootonly.iso
12. vm console myguest

Line 1
Install vm-bhvye.

Add the grub2-bhyve package if you want Linux grub support, and the UEFI port to run UEFI bootable operating systems, including Windows.

Line 2
Create a dataset for your virtual machines. If you're not using ZFS, just create a normal directory.

Lines 3-4
Enable vm-bhyve in /etc/rc.conf and set the dataset to use. If not using ZFS, just set $vm_dir="/my/vm/folder".

Line 5
Run the vm init command to create the required directories under $vm_dir and load kernel modules.

Line 6 Install the sample templates that come with vm-bhyve.

Lines 7-8
Create a virtual switch called 'public' and attach your network interface to it. Replace em0 with whatever interface connects your machine to the network.

Line 9
Download a copy of FreeBSD from the FTP site.

Lines 10-12
Create a new guest using the default.conf FreeBSD template, run the installer and then connect to its console. At this point proceed through the installation as normal. By specifying the -f option before the install command, the guest will run directly on your terminal so the console command is not required. (Please note the -f option is only supported in vm-bhyve-0.12.5+.)

You can’t perform that action at this time.