Re: Having problem with postgresql configuration (template1 doesn't exist)? - Mailing list pgsql-admin

From Tom Lane
Subject Re: Having problem with postgresql configuration (template1 doesn't exist)?
Date
Msg-id 15094.1108921716@sss.pgh.pa.us
Whole thread Raw
In response to Having problem with postgresql configuration (template1 doesn't exist)?  (Vinicius <cviniciusm@terra.com.br>)
Responses Re: Having problem with postgresql configuration (template1 doesn't  (Vinicius <cviniciusm@terra.com.br>)
List pgsql-admin
Vinicius <cviniciusm@terra.com.br> writes:
> postgres$ initdb -D /usr/local/pgsql/data"

> the file /var/log/messages shows:
> "Feb 20 02:01:38 ronin kernel: audit(1108875698.227:0): avc:  denied  {
> write } for  pid=8229 exe=/usr/bin/postgres name=data
> dev=dm-0 ino=1687533 scontext=user_u:system_r:postgresql_t
> tcontext=root:object_r:usr_t tclass=dir

You can't put the data directory in a nonstandard place under SELinux
unless you modify the security policy to allow the postgres daemon to
write in that nonstandard place.  The normal behavior of
selinux-policy-targeted is to confine postgres to /var/lib/pgsql.

So: (1) use /var/lib/pgsql/data, (2) modify the policy, or (3)
disable SELinux enforcement.

BTW, since you are using the RPMs, why are you bothering with manual
database setup?  "sudo /sbin/service postgresql start" is all you
need to do.

            regards, tom lane

pgsql-admin by date:

Previous
From: Vinicius
Date:
Subject: Having problem with postgresql configuration (template1 doesn't exist)?
Next
From: Vinicius
Date:
Subject: Re: Having problem with postgresql configuration (template1 doesn't