I've read that calling initdb directly in this environment is
discouraged because the suite of tools packaged with the software such
as pg_createcluster
Yes, but pg_createcluster
can pass through options to initdb
, so it makes no difference on the configurability.
From the manpage:
SYNOPSIS
pg_createcluster [options] version name [-- initdb options]
Example:
# pg_createcluster 9.5 test -- --username=daniel
Creating new cluster 9.5/test ...
config /etc/postgresql/9.5/test
data /var/lib/postgresql/9.5/test
locale en_US.UTF-8
socket /var/run/postgresql
port 5433
# pg_ctlcluster 9.5 test start
Redirecting start request to systemctl
# su daniel -c 'psql --cluster 9.5/test -l'
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
-----------+--------+----------+-------------+-------------+-------------------
postgres | daniel | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
template0 | daniel | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/daniel +
| | | | | daniel=CTc/daniel
template1 | daniel | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/daniel +
| | | | | daniel=CTc/daniel
(3 rows)
# pg_dropcluster --stop 9.5 test
Redirecting stop request to systemctl