HOW TO INSTALL OPENBSD ON DIGITALOCEAN
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: Once done that, power off the virtual machine and click to Boot From Recovery ISO from the “Recovery” menu.
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: Now that we have a shell, we can fetch the openbsd image from its official website. type the following commands:
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.
$> wget https://cdn.openbsd.org/pub/OpenBSD/7.0/amd64/miniroot70.img $> dd if=miniroot70.img of=/dev/vda bs=512k
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.
If you try to start the vm again, you should see OpenBSD installer booting up, instead of the previous operating system. Let's type
Ito 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: Fill the various values according to the right color, i.e.
- IPv4 Address for vio0: The IP address of your server;
- Netmask for vio0: The netmask of your server;
- Default IPv4 route: The gateway of your server.
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
Wfor Whole Disk MBR and then
Cfor custom layout. In my configuration I used the following schema: