HOW TO INSTALL OPENBSD ON DIGITALOCEAN

2021-12-06
installing GIF Recently, I had to set up a new server based on OpenBSD on DigitalOcean. While they do support non-Linux systems such as FreeBSD, they do not provide official supports for other BSD flavours such as OpenBSD. In this guide, we will see how to overcome this small inconvenient by manually flashing the installer image in the boot sector of the hard drive. Let's get started.

Create A New Droplet

The first thing we need to do is to create a new droplet from the main menu of DigitalOcean as shown in the following picture. You can choose any operating system, it does not matter: new droplet Once done that, power off the virtual machine and click to Boot From Recovery ISO from the “Recovery” menu. change boot disk

Enter Recovery Mode

Now restart the machine and open the web console. Let the Ubuntu-based recovery system to power up. Once you reach the following interface, choose the sixth option: recovery CLI Now that we have a shell, we can fetch the openbsd image from its official website. type the following commands:
                
$> wget https://cdn.openbsd.org/pub/OpenBSD/7.0/amd64/miniroot70.img
$> dd if=miniroot70.img of=/dev/vda bs=512k
                
            
This will download the miniroot base system(i.e. a net install) and then flash it into the first 512 bytes of the hard drive(the boot sector). Unfortunately, we cannot download the whole system right now since it won't fit into the recovery overlay filesystem.

Once done that, power off the system by typing poweroff. Now go back to the recovery tab and set back the hard drive as the default booting device.

Booting OpenBSD

If you try to start the vm again, you should see OpenBSD installer booting up, instead of the previous operating system. Let's type I to begin the installation process, answer the installer questions according to your needs but stop just before the network configuration.

Configure The Network

By default, DigitalOcean configures the network at the first boot using the cloud init scripts but, since OpenBSD is not supported, we have to do it by ourselves. Take a look at the following picture: network configuration Fill the various values according to the right color, i.e. You can also choose different name servers, but do not leave that field blank, or you will not be able to download the installation files.

Partition The Disk

Now it is time to create new partitions. The default partition schema will not probably work(the root partition needs to be expanded), so we will create them by hand. When prompted, choose W for Whole Disk MBR and then C for custom layout. disk partition In my configuration I used the following schema:
Name Size
Swap 2048 MiB
Root 23 GiB
and this is how I created them: disk config root

Installing Base System

Now we can complete the installation by downloading the sets from the net. Follow the picture below for the right server: base system installing You can leave all the archives selected or manually remove unneeded ones(for example the X11 related stuff). Then, the installer will proceed downloading and extracting them without asking you any further question. install progress Once done, reboot the machine. OpenBSD should now be installed!