Install OpenBSD on a server
Steps to install OpenBSD on a server with KVM access.
Me
874 Words 3 Minutes, 58 Seconds
16 Dec 2025
OpenBSD on OVH server
While OpenBSD is great on a laptop, it can also be installed on a server. Many hosting providers don't offer OpenBSD, but it can be installed manually. This article describes the installation of OpenBSD on a server having a KVM console offered by the hosting provider.
Installing a Linux distribution
The first step is to install a Linux distribution on the server, as offered by the hosting provider. It should work with any distributions, but is tested with Ubuntu 24.04.
Issues and why I do it this way
If your server has two disks, one with the running Linux distribution and one free, you can simply write minirootXX.img to the second disk, reboot, enter the GRUB shell and use the "chainloader" command to call OpenBSD's bootloader, followed by the "boot" command. Not all servers have two disks, so in this article I present a way to install OpenBSD on a server having only one disk.
Before OpenBSD 7.3, it was possible to boot the OpenBSD kernel from GRUB using the "kopenbsd" module, but this option isn't supported anymore.
Having only one disk, running the Linux distribution, I tried to write minirootXX.img to it using dd but when rebooting, the OpenBSD bootloader failed to load the kernel, which seemed to be corrupted, each time.
The clean way to do it would be to put a copy of the OpenBSD bootloader in the EFI partition to call it from GRUB using "chainloader", and create a new GPT partition on the disk to contain the OpenBSD kernel. Unfortunately the incompatibility between Linux and OpenBSD makes it difficult. The OpenBSD bootloader can only find the kernel in an OpenBSD partition containing a disklabel, with the root disklabel partition using the FFS filesystem. On the Linux side, there is no tools to create or manipulate a disklabel, nor to create the FFS2 filesystem.
I ended creating my own miniroot-like disk using GPT instead of MBR, overwriting the disk where the Linux distribution was running, and when rebooting the OpenBSD installer was working.
Creating the disk image
In this section I create a complete disk image with two GPT partitions. If you don't want to do it, you can simply use the one I created and move to the next section, after checking the SHA256 sum of the file.
SHA256 (vdisk-40M.img.tar.gz) = fc84517921173350053eeeeaad8509eb317703b256ccd7e51e6ed4b50e54323e
To create the disk, enter the following commands. They create a 40MB file representing the disk image, configure it as a vnode pseudo disk, create the GPT and disklabel partitions, the filesystems, and copy the OpenBSD files to the right location. I assume the OpenBSD files have already been downloaded and their integrity checked.
Note: you can add the filesets to the disk to avoid downloading them from the server. If you do so, you should create an image larger than 40MB.
dd if=/dev/zero of=vdisk.img bs=1M count=40
doas vnconfig vnd0 vdisk.img
doas fdisk -g vnd0 # Type 'y' to confirm
# The following command enters the interactive editor. Type "edit 0", choose
# partition id "EF" for EFI, offset 64, size 71000. Then type "edit 1",
# partition id "A6" for OpenBSD, default offset, default size.
doas fdisk -e vnd0
# The following command enters the interactive editor. Type "a" to add a new
# disklabel partition, then default choices should be OK. It should apply
# only on the OpenBSD partition, not the EFI one, and filesystem 4.2BSD should
# be the default. Enter "quit" to save and quit.
doas disklabel -E vnd0
doas disklabel vnd0 # Display the disklabel partitions
doas newfs -t msdos -c 1 -F32 vnd0i
doas newfs -t ffs vnd0a
mkdir -p ~/mnt
doas mount /dev/vnd0i ~/mnt
mkdir -p ~/mnt/EFI/BOOT/
cp BOOTX64.EFI ~/mnt/EFI/BOOT/
doas umount ~/mnt
doas mount /dev/vnd0a ~/mnt
doas cp bsd.rd ~/mnt/bsd
# The filesets can be copied in ~/mnt/ here
doas umount ~/mnt
doas fdisk vnd0 # Display the GPT partitions
doas vnconfig -u vnd0You're now ready to copy vdisk.img on the server and write it to the disk.
Replacing the files in the disk image
This step is needed only if you used my disk image instead of creating yours. Since it contains the files for OpenBSD 7.8, you can replace them with the version you're interested in.
The following commands configure the disk image as a vnode pseudo disk to mount the partitions and replace the files. I assume you already downloaded them and checked their integrity.
mkdir -p ~/mnt
doas vnconfig vnd0 vdisk.img
doas disklabel vnd0 # Display the dislabel partitions
doas mount /dev/vnd0i ~/mnt
cp path/to/BOOTX64.EFI ~/mnt/EFI/BOOT/
doas umount ~/mnt
doas mount /dev/vnd0a ~/mnt
doas cp path/to/bsd.rd ~/mnt/bsd
doas umount ~/mnt
doas vnconfig -u vnd0Writing the disk image on the server
From now on, vdisk.img is ready to be copied to your server. Once on the server, you can write the image to the disk, don't forget to replace "sda" with your disk:
sudo dd if=vdisk.img of=/dev/sda;sync
sudo rebootAccess the KVM console offered by the hosting provider, refresh the tab if the connection is lost, you should see the OpenBSD installer.
You can follow the standard instructions to install OpenBSD and encrypt the disk.