PostgreSQL database

Installation

Defguard Core uses a PostgreSQL database for storage, so if you do not have it installed and configured yet, you can do so in this section. For this tutorial, we need to create a user with superuser privileges and a database.

First, install the PostgreSQL package:

On Debian/Ubuntu:

apt install postgresql postgresql-contrib

On Fedora/Red Hat:

dnf install postgresql-server

Also, check the PostgreSQL installation documentation for Fedora.

On FreeBSD:

pkg install postgresql18-server postgresql18-contrib

Also, check the PostgreSQL installation documentation for FreeBSD.

On NetBSD:

pkg_install postgresql18-server postgresql18-contrib

Also, check the PostgreSQL installation documentation for NetBSD.

Configuration

Here is a brief guide on how to create a dedicated database user and a database for Defguard Core.

First, issue this command to create a new database user named defguard. The command will prompt for a password for the new user.

Then, create a new database named defguard and assign the user defguard as its owner.

At this point, it might be useful to store the database connection details in the .pgpass file. The file format and its usage are described in the PostgreSQL documentation.

Was this helpful?