A few weeks ago, I was new to bhyve and had pretty hard time to install Windows Server 2019 on FreeBSD 12.1R + bhyve. However, I could manage to install it and would like to share the how-to because there's little information available on it. Any suggestions on modification, additional information, etc are welcome.
Note I have skipped AutoUnattend.xml as none of AutoUnattend.xml I tested worked including ones automatically created online.
Load the following kernel modules (aesni is optional):
Also add those modules to kld_list on /etc/rc.conf like:
Install the following packages:
Suppose your bhyve home directory is /home/bhyve, then go there and mkdir iso-remaster:
Download a Windows Server 2019 iso file and put it under the current dir.
Download the latest Linux virtio iso file such as virtio-win-0.1.189.iso from https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/archive-virtio/ and put it under the current dir.
Suppose the downloaded Windows iso file is windows.iso, then unarchive it by:
Create an installation iso file install.iso as follows:
Create a bhyve image file as follows (replace ‘80GB’ with your favorite size):
Start installing Windows Server 2019 as follows:
Also, monitor the Windows screen by:
Note you may need to run it as a non-root user.
Once the first step of the installation is done, Windows tries to reboot and bhyve exits.
In the next step, you need to start bhyve as follows. This also mounts virtio-win-XX.iso as a CD drive so you can install virtio virtual ethernet driver later. Replace virtio-win-0.1.189.iso with your virtio driver downloaded above.
Access the Windows screen with:
Open Windows Explorer and go to “CD Drive (D: ) - NetKVM - 2k19 - amd64”. Then right click ‘netkvm.inf’ and install it. The virtual network adaptor will now be active.
After the installation, you can start bhyve with the above command or the same command without:
line.
Note I have skipped AutoUnattend.xml as none of AutoUnattend.xml I tested worked including ones automatically created online.
Load the following kernel modules (aesni is optional):
# kldload vmm nmdm aesni
Also add those modules to kld_list on /etc/rc.conf like:
kld_list="vmm nmdm aesni"
Install the following packages:
# pkg install p7zip cdrtools uefi-edk2-bhyve tightvnc
Suppose your bhyve home directory is /home/bhyve, then go there and mkdir iso-remaster:
# mkdir iso-remaster
Download a Windows Server 2019 iso file and put it under the current dir.
Download the latest Linux virtio iso file such as virtio-win-0.1.189.iso from https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/archive-virtio/ and put it under the current dir.
Suppose the downloaded Windows iso file is windows.iso, then unarchive it by:
# 7z x windows.iso -oiso-remaster
Create an installation iso file install.iso as follows:
mkisofs \
-b boot/etfsboot.com -no-emul-boot -c BOOT.CAT \
-iso-level 4 -J -l -D \
-N -joliet-long \
-relaxed-filenames -v \
-V "Custom" -udf \
-boot-info-table -eltorito-alt-boot -eltorito-platform 0xEF \
-eltorito-boot efi/microsoft/boot/efisys_noprompt.bin \
-no-emul-boot \
-o install.iso iso-remaster
Create a bhyve image file as follows (replace ‘80GB’ with your favorite size):
# truncate -s 80GB win2019.img
Start installing Windows Server 2019 as follows:
bhyve \
-c 2 \
-s 0,hostbridge \
-s 3,ahci-hd,win2019.img \
-s 4,ahci-cd,install.iso \
-s 10,virtio-net,tap0 \
-s 29,fbuf,tcp=0.0.0.0:5900,w=1280,h=720,wait \
-s 30,xhci,tablet \
-s 31,lpc \
-l com1,/dev/nmdm0A \
-l com2,/dev/nmdm1A \
-l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd \
-m 8G -H -w \
win2019
Also, monitor the Windows screen by:
% vncviewer localhost:5900
Note you may need to run it as a non-root user.
Once the first step of the installation is done, Windows tries to reboot and bhyve exits.
In the next step, you need to start bhyve as follows. This also mounts virtio-win-XX.iso as a CD drive so you can install virtio virtual ethernet driver later. Replace virtio-win-0.1.189.iso with your virtio driver downloaded above.
bhyve \
-c 2 \
-s 0,hostbridge \
-s 3,ahci-hd,win2019.img \
-s 4,ahci-cd,virtio-win-0.1.189.iso \
-s 10,virtio-net,tap0 \
-s 29,fbuf,tcp=0.0.0.0:5900,w=1280,h=720 \
-s 30,xhci,tablet \
-s 31,lpc \
-l com1,/dev/nmdm0A \
-l com2,/dev/nmdm1A \
-l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd \
-m 8G -H -w \
win2019
Access the Windows screen with:
% vncviewer localhost:5900
Open Windows Explorer and go to “CD Drive (D: ) - NetKVM - 2k19 - amd64”. Then right click ‘netkvm.inf’ and install it. The virtual network adaptor will now be active.
After the installation, you can start bhyve with the above command or the same command without:
-s 4,ahci-cd,virtio-win-0.1.189.iso \
line.