Couldn't find postgresql.conf & pg_hba.conf files in my postgresql installation

If you type the following:

sudo su - postgres

after installing postgresql-server, that should take you right to the home directory of postgres and will have the configuration files you are looking for. Usually in a RHEL environment, the configuration files would be stored in /var/lib/pgsql/. On my test environment it is stored in /var/lib/pgsql/9.1/data.


Use linux command locate (Docs: http://man7.org/linux/man-pages/man1/locate.1.html)

[root@CENTOS7 pgsql]# locate pg_hba.conf
/usr/pgsql-10/share/pg_hba.conf.sample
/var/lib/pgsql/10/data/pg_hba.conf

I am in CenOS 7, locate is not installed by default. Similar to the answer above, but run with show cmd below:

psql -U postgres -c 'show config_file'

And find the files are in /data/pgdata/postgresql.conf.