26

Following all the instructions from UNIXMEN, installed postgresql-9.4 in CentOS 6.4. Everything went well, started the service and could access pgsql screen. But when I try to configure the phpPgAdmin, I couldn't find the files

  • postgresql.conf
  • pg_hba.conf
  • config.inc.php
  • phpPgAdmin.conf

The instructions says, postgresql home directory will sit in /etc/../ and some say it will be in /var/lib/. Where does the directory gets created (in CentOS)?

Is installation directory path is different in centos, redhat(RHEL7) & ubuntu?

Update: I ran a quick locate command for *postgresql.conf** and *hba.conf**, I found the sample files as postgresql.conf.sample and pg_hba.conf.sample (at /usr/pgsql-9.4/share/ )

  • 2
    Is there a postgres user? Can you try: sudo su - postgres? That will take you right to the postgres home directory and you should be able to locate the pg_hba.conf file...Usually in RHEL/CentOS it would be in /var/lib/psql/ or something of that nature... – ryekayo Oct 6 '15 at 17:45
  • awesome.. there it is, now I can see the files. But what is the reason that they didn't appear when I executed locate command?? @ryekayo – GIRI Oct 6 '15 at 17:48
  • that i'm not too sure of.. What was the command you did with locate? – ryekayo Oct 6 '15 at 18:08
  • locate .conf*/ *.conf / .conf were the command that I used. – GIRI Oct 6 '15 at 18:14
  • Well i would recommend using find for one, since you do have the file name...But if what i suggested solved your problem I will go ahead and add that as answer. – ryekayo Oct 6 '15 at 18:15
38

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.

  • 1
    Saved my day. It's working for postgres 9.2 – Rahal Kanishka Nov 7 '17 at 6:42
1

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.