I had postgres9.6 installed and working the other day but the version wasn't compatible.

I used YUM REMOVE to remove that one and then followed the instructions here https://www.postgresql.org/download/linux/redhat/ to install postgres10.

However anytime I do the

/usr/pgsql-10/bin/postgresql-10-setup initdb

it returns

Initializing database ... mkdir: cannot create directory ‘/var/lib/pgsql’: Permission denied

Initializing database ... failed, see /var/lib/pgsql/10/initdb.log

However the log file is actually empty.

I've tried a number of things suggested with no success. Any advice would be great as to where to start looking about this

  • I think the error message is self-explanatory -- the postgres user cannot create a directory under /var/lib (which is normal). Create one and give it proper ownership. – mustaccio Mar 7 '19 at 16:53
  • You need to run that as root – a_horse_with_no_name Mar 7 '19 at 20:58

Your Answer

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

Browse other questions tagged or ask your own question.