I decided to to run PostgreSQL on my Fedora 20, so I did

sudo yum install postgresql-server.x86_64 postgresql-libs.x86_64 postgresql.x86_64

Now if I do postgres -D /var/lib/pgsql/data under regular user I receive Permission denied for "/var/lib/pgsql/data/postgresql.conf", if I try it under root I get some error about that I shouldn't run postgres under the privileged user.

I understand these two errors, but now it's getting weird - sudo -u postgres postgres -D /var/lib/pgsql/data gives me error I am missing postgresql.conf - if I create it under root (because root owns the directory) it again complains about permissions during startup. If I try to run initdb -D /var/lib/pgsql/data it doesn't work too because if improper rights (dir is owned by root).

So I am really not sure what I am supposed to do, is there anything that I have done wrong? Because everything in /var/lib/ is owned by root and it's default place for configuration in Fedora (at least for postgres) so it seems to me really messed up.


Read /usr/share/doc/postgresql/README.rpm-dist, it covers setup. In particular, it tells you that to create the data directory you must run:

postgresql-setup initdb

If you were using the PGDG RPMs from http://yum.postgresql.org/ instead of the stock Red Hat ones, it'd be:

/usr/pgsql-9.3/bin/postgresql93-setup initdb

I'm currently looking at ways we can improve the official PostgreSQL documentation to make it easier for people who've installed PostgreSQL from common packages like Fedora's RPMs or the Ubuntu packages. It's currently too focused on source installs.

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.