Miniflux server setup on OpenBSD

I go over how to setup a Miniflux server on OpenBSD. Miniflux is a minimalist and opinionated RSS feed reader.

These steps should apply to OpenBSD 6.7 or greater.

  1. Miniflux uses PostgreSQL as the database, and we also need wget to download Miniflux so the first step is to install the packages.
pkg_add postgresql-server postgresql-client wget
  1. Enable PostgreSQL to start at boot.
rcctl enable postgresql
  1. If you are installing PostgreSQL for the first time, you have to create a default database first. In the following example we install a database in /var/postgresql/data with a dba account ‘postgres’ and scram-sha-256 authentication. We will be prompted for a password to protect the dba account, assure you save this somewhere safe.
# su - _postgresql
$ mkdir /var/postgresql/data
$ initdb -D /var/postgresql/data -U postgres -A scram-sha-256 -E UTF8 -W
  1. While running as _postgresql still, start the postgresql server and then run exit to return to the root account.
$ pg_ctl -D /var/postgresql/data -l logfile start
$ exit
  1. Now create the database and user for Miniflux (Assure to create a very strong password, and save it somewhere safe.)
$ createuser -U postgres --pwprompt --no-superuser --createdb --no-createrole miniflux
$ createdb -U miniflux miniflux
  1. Create the hstore extension with the postgres user as it has SUPERUSER privileges. This is needed by miniflux before the database initialization can happen or work. Run the commands and then run exit to return to the root account.
# su - _postgresql
$ psql miniflux
> q\
$ exit
  1. Change to the /tmp directory and download the OpenBSD miniflux binary. Check the releases page to assure you are downloading the latest version.
cd /tmp
  1. Move and rename the downloaded binary, we need to put it in /usr/local/bin as it is not a system binary.
mv miniflux-openbsd-amd64 /usr/local/bin/miniflux
  1. We need to mark the miniflux binary executable, use chmod and set the executable bit.
chmod +x /usr/local/bin/miniflux
  1. Time to prepare for the rc script, we need a user for the daemon to run as and it needs to be low privilege.
useradd -s /sbin/nologin -d /nonexistent -L daemon -u 447 _miniflux
  1. This is the rc script to start Miniflux and other actions, allowing you to have control in a standard way.

vi /etc/rc.d/miniflux

# $OpenBSD: miniflux,v 1.0 2020/10/18 17:49:00 rpe Exp $

daemon="/usr/local/bin/miniflux -c /etc/miniflux.conf"

. /etc/rc.d/rc.subr

pexp="/usr/local/bin/miniflux -c /etc/miniflux.conf"

rc_stop() {
        pkill -f "^${pexp}"

rc_reload() {
        pkill -HUP -xf "^${pexp}"
        ${rcexec} "${daemon}"

rc_check() {
        pgrep -q -xf "^${pexp}"

rc_restart() {
        pkill -f "^${pexp}"
        ${rcexec} "${daemon}"

rc_start() {
        ${rcexec} "${daemon}"

rc_cmd $1
  1. Set the proper permissions for the new rc file.
chmod 555 /etc/rc.d/miniflux
  1. Enable miniflux to start at boot, but do not start the service yet.
rcctl enable miniflux
  1. Miniflux needs a config file to control the variable to change the standard database name, username, and password, and also to make the web interface listen of any address instead of only. Fill out the database password below to the miniflux database user password you set in step 5.

vi /etc/miniflux.conf

DATABASE_URL=user=miniflux password=your password dbname=miniflux sslmode=disable
  1. Run the SQL migrations to initialize the database.
miniflux -c /etc/miniflux.conf -migrate
  1. Create an admin user. This is also used to login to the web interface as the first user.
miniflux -c /etc/miniflux.conf -create-admin
  1. Now we are finally ready to start Miniflux!
rcctl -d start miniflux
  1. You can now connect to the web interface at http://x.y.x.y:8080/