Need to migrate your e-mails to a new server? Free and paid versions of our online tool available.
Hero Image

Install PostgreSQL on NetBSD 10

Install PostgreSQL on NetBSD 10

Step 1 – Install

pkgin install postgresql16-server postgresql16-client
su -l pgsql -c 'initdb -D /usr/pkg/pgsql/data'
echo 'pgsql=YES' >> /etc/rc.conf && service postgresql start

Step 2 – Connect as superuser

sudo -u postgres psql

Step 3 – Create database and user

CREATE USER appuser WITH PASSWORD 'StrongPass123!';
CREATE DATABASE appdb OWNER appuser;
GRANT ALL PRIVILEGES ON DATABASE appdb TO appuser;
\q

Key files

File Purpose
/usr/pkg/pgsql/data/postgresql.conf Server settings
/usr/pkg/pgsql/data/pg_hba.conf Client authentication

Allow remote connections (optional)

/usr/pkg/pgsql/data/postgresql.conf: listen_addresses = '*'

/usr/pkg/pgsql/data/pg_hba.conf: host appdb appuser 0.0.0.0/0 scram-sha-256

systemctl reload postgresql 2>/dev/null || rc-service postgresql-14 reload 2>/dev/null || rcctl reload postgresql