The following bug has been logged on the website:
Bug reference: 15108
Logged by: Alertas DBA
Email address: alertas.dba@click-it.es
PostgreSQL version: 10.3
Operating system: Centos 7.4.1708
Description:
The problem is reported when executing database initialization command,
postgresql-10-setup initdb.
In the official documentation
(https://www.postgresql.org/docs/10/static/app-initdb.html) indicates that
it must be executed with the user postgres, but the command only works if I
execute it as root.
This command does not seem to interpret the parameter step indicated in the
documentation, these are the problem:
(run as root) yum install -y
https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-7-x86_64/pgdg-centos10-10-2.noarch.rpm
(run as root) yum install -y postgresql10 postgresql10-server
(run as root) cd /
(run as root) mkdir data
(run as root) chown -R postgres.postgres data
(run as postgres) /usr/pgsql-10/bin/postgresql-10-setup initdb
-bash-4.2$ /usr/pgsql-10/bin/postgresql-10-setup initdb -D /data -A trust -U
postgres
systemctl: invalid option -- 'D'
failed to find PGDATA setting in -D.service
-bash-4.2$ /usr/pgsql-10/bin/postgresql-10-setup initdb -D /data/ -A trust
-U postgres
systemctl: invalid option -- 'D'
failed to find PGDATA setting in -D.service
-bash-4.2$ /usr/pgsql-10/bin/postgresql-10-setup initdb --pgadata=/data/ -A
trust -U postgres
systemctl: unrecognized option '--pgadata=/data/.service'
failed to find PGDATA setting in --pgadata=/data/.service
Should the environment variable PGDATA in
/usr/lib/systemd/system/postgresql-10.service be overwrited after the
database is initialized?