I am trying to setup Postgres 12 on Centos 8.
Postgres shall be installed in the default directory i.e.
/var/lib/pgsql, however I want the data directory to be in
I want to use postgresql-setup as root, as I believe it will create systemd service files along with it, rather than using pg_ctl or running initdb as postgres user.
However, if I try
$ postgresql-setup --initdb --pgdata=/data/pgsql/
I will receive the following error.
postgresql-setup: unrecognized option '--pgdata=/data/pgsql'
FATAL: can't parse arguments
What is the best way to achieve this?