An OpenBSD learning/dev VM to be built and run from your own desktop.
Created by Packer and run by Vagrant.
Packer will download the OpenBSD installation media, stable installXX.iso
, and then handle the full install start to finish - all automatically - with the end result being a reusable image to create virtual machines from.
Check the packer HCL:
cd packer
packer validate openbsd.pkr.hcl
packer inspect openbsd.pkr.hcl
Logging is set by changing this environment variable, if anything goes wrong verbosity can be increased.
Windows (powershell):
$env:PACKER_LOG=4
Mac, Linux, BSD:
export PACKER_LOG=4
You can use the env var PACKER_LOG_PATH=/tmp/packer.log
to set a log file.
packer build -only=openbsd-vb -force openbsd.pkr.hcl
Hyper-V build on Windows desktops
packer build -only=openbsd-hv -force openbsd.pkr.hcl
You can enable nesting on HyperV. On an existing shutdown Vagrant vm:
Set-VMProcessor -VMName openbsd -ExposeVirtualizationExtensions $true
You need to do this to use vmm, the OpenBSD hypervisor.
QEMU is a generic and open source machine emulator and virtualizer.
packer build -only=openbsd-qu -force openbsd.pkr.hcl
You will need a VNC client to monitor progress.
VMware build
packer build -only=openbsd-vw -force openbsd.pkr.hcl
Vmware needs testing still.
Vagrant is a tool for managing portable virtual machines, it's a wrapper on virtualization.
This imports the Box we just made with Packer and will then create a VM from it:
vagrant box add boxes/OpenBSD.box --name OpenBSD.box
cd ../vagrant
vagrant validate Vagrantfile
vagrant up
Login:
vagrant ssh
man intro
You might want to use vagrant rsync-auto
in a separate shell.
Remove everything when finished:
exit
vagrant destroy
vagrant box remove OpenBSD.box
The steps above have been automated in build.{sh,ps1}
and clean.{sh,ps1}
.
./build.ps1
vagrant ssh
tmux
exit
./clean.ps1
For better or worse, you can install Powershell on MacOS and Linux.
Win 10 includes Windows Subsystem for Linux which Vagrant also supports WSL.
Useful documentation + code + guides
man afterboot
man security
OpenBSD Docs