Using OpenBSD as a host for VMs. Part 2. Install OpenBSD as the host OS

Install OpenBSD 7.2 as the host OS

In this article, I install OpenBSD 7.2 on a host machine.

Storage mapping (SSD + HDD + flash stick are SATA devices):

  • sd0, sd1 -> SSD;
  • sd2, sd3, sd4, sd5 -> data HDDs;
  • sd6 -> USB stick.

Prepare for OpenBSD installation

Two SSDs will be used in RAID1 softraid with encryption for the host system.

According to the official guide, we will conduct the preparatory stage in the shell.

Using shell

Create device nodes for the SSDs (in my case sd0 and sd1):

cd /dev && sh MAKEDEV sd0 sd1

Write random data to the drives:

dd if=/dev/urandom of=/dev/rsd0c bs=1m
dd if=/dev/urandom of=/dev/rsd1c bs=1m

Initialize the disk with fdisk(8):

fdisk -iy sd0
fdisk -iy sd1

Create the partition layout with disklabel(8):

Create the partition layout

Create a 1 MB partition on the USB stick (in my case sd6) to unlock your encrypted disk. 2048 is the size of 1 MB:

cd /dev && sh MAKEDEV sd6
dd if=/dev/urandom of=/dev/rsd6c bs=1m
fdisk -iy sd6
disklabel -E sd6

Create a partition on the USB stick

Create softraid0 with encryption via partition sd6a on the USB stick with bioctl(8):

bioctl -c 1C -k sd6a -l sd0a,sd1a softraid0

The softraid0 device node can be found in the output: sd7.

Create device node for sd7 and overwrite the first megabyte of our new pseudo-device:

cd /dev && sh MAKEDEV sd7
dd if=/dev/zero of=/dev/rsd7c bs=1m count=1

Install OpenBSD

In this case, I install OpenBSD 7.2 using the official FAQ.

I use only the SSD as storage for the base system during the installation process. Storage for VMs will be added afterward.

The installation process is simple:

  • Select the keyboard layout (us).
  • Set the hostname to vm-01.hs.local.
  • Choose automatic configuration for the network interface (using em0).
  • Set a password for root.
  • Enable sshd by default.
  • Answer no to the question about using the X Window System (running X on a server is generally not recommended).
  • Skip adding a new user (I will do it after installation).
  • Allow login via SSH for root (for security reasons it will be disabled after setup).
  • Set the timezone. In my case, the timezone is Europe/Moscow.
  • Use the whole disk. Note: The device node for softraid0 is sd7. You can show all available disks by using the question mark.
  • Choose the location for the sets (in this example I use the network).
  • Remove the game and comp sets for security reasons.

Removing game and comp sets

Conclusion

Well done! OpenBSD 7.2 was installed as the host system on the server. Now the server should be rebooted.