postgresql-setup --help outputs:
Usage: /usr/bin/postgresql-setup MODE_OPTION [--unit=UNIT_NAME] [OPTION...]
...
Available operation mode:
--initdb Initialize new PostgreSQL database cluster. This is usually the
first action you perform after PostgreSQL server installation.
...
Environment:
PGSETUP_INITDB_OPTIONS Options carried by this variable are passed to
subsequent call of `initdb` binary (see man
initdb(1)). This variable is used also during
'upgrade' mode because the new cluster is actually
re-initialized from the old one.
However when I run something like:
> export PGSETUP_INITDB_OPTIONS="--auth=scram-sha-256 --username=admin_user --pwprompt /var/lib/pgsql/data";
> sudo postgresql-setup --initdb
It doesn't seem to apply the options in PGSETUP_INITDB_OPTIONS. The auth in /var/lib/pgsql/data/pg_hba.conf still reads:
# TYPE DATABASE USER ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all all peer
# IPv4 local connections:
host all all 127.0.0.1/32 ident
# IPv6 local connections:
host all all ::1/128 ident
# Allow replication connections from localhost, by a user with the
# replication privilege.
local replication all peer
host replication all 127.0.0.1/32 ident
host replication all ::1/128 ident
(None are scram-sha-256)
Also, I wasn't prompted for a password and super user still seems to be postgres.
I'm using:
- postgresql 12.11
- Os: Rocky Linux release 8.6 (Green Obsidian)
Am I doing something wrong here?