HOW TO INSTALL OPENBSD ON DIGITALOCEAN
2021-12-06
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 Mod
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:
$> 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 typeI
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: 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, chooseW
for Whole Disk MBR and then
C
for custom layout.
In my configuration I used the following schema:
Name | Size |
---|---|
Swap | 2048 MiB |
Root | 23 GiB |