OpenBSD Server Setup

⬅ Back to Notes

Updated 2021-03-24. (Tested on OpenBSD 6.8)

A screenshot of my terminal showing a text art of a pufferfish--OpenBSD's mascot.

I’m a new OpenBSD user. I find the minimalist and security-focused philosophy of the OS attractive, so I’ve been learning about it on an instance hosted on OpenBSD Amsterdam.

The Basics

Fish

I like how easy it is to write shell scripts in Fish, so it’s been my default shell for a while. All the little conveniences like autocomplete are amazing, so it’s honestly one of the first things that I do when setting up a new system.

$ doas pkg_add fish 
$ chsh -s /usr/local/bin/fish jag

YADM

I use YADM to manage my dotfiles. There isn’t a package available on OpenBSD, but since it’s written in shell I could simply pull it in. It does require you to have Bash and Git installed, so make sure to do doas pkg_add bash git as well before running YADM.

$ doas curl -fLo /usr/local/bin/yadm https://github.com/TheLocehiliosan/yadm/raw/master/yadm 
$ doas chmod a+x /usr/local/bin/yadm 
$ doas pkg_add bash git

Fisher

Fisher is how I manage my Fish plugins. It unfortunately failed to run on OpenBSD when I tried it, so I sent a small patch to fix that. It should work well now:

$ curl -sL https://git.io/fisher | source && fisher install jorgebucaran/fisher
$ fisher update

fzf (and friends)

I don’t know how I lived without fzf in the past. It makes it easy for me to find files and visually go through my shell history. Installing it is easy:

$ doas pkg_add fzf

Integrating it with Fish takes a bit more work, though. First, install fzf integration with Fish:

$ fisher install patrickf3139/fzf.fish

Then we need to compile fd so we need the Rust compiler. It took a while for my little machine to compile all the dependencies:

$ doas pkg_add rust
$ cargo install fd-find

Then we add the binaries to our $PATH by adding set PATH $PATH $HOME/.cargo/bin to ~/.config/fish/config.fish.

We also need bat, but unfortunately one of the dependencies failed to compile on my machine. It still works well even if bat is missing.

A short video demonstrating the use of fzf even though bat is missing.

Dev Environment

Node

I use CoffeeScript and Browsersync for my generative art and they both need Node to work. I would use Node Version Manager (either the Bash script version or the Fish shell version) but neither of them support OpenBSD. So I installed Node through pkg_add:

$ doas pkg_add node

It’s an old version of node, but it works!

CoffeeScript and Browsersync

I then installed these two tools globally:

$ doas npm install -g coffeescript
$ doas npm install -g browser-sync

Micro Editor

I enjoy using the Micro editor and a package does exist on OpenBSD. Unfortunately it’s an old version so my plugins didn’t seem to work well. I’m lucky that an OpenBSD binary is available on GitHub though!

I downloaded the binary then moved it to /usr/local/bin/micro

Changing Timezone

Since OpenBSD.Amsterdam is in another timezone, the time on my system is off. This makes it easier to work with cron, e-mail clients, and time tracking software.

$ doas ln -sf /usr/share/zoneinfo/America/New_York /etc/localtime

Services