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

From Vinicius
Subject Re: Having problem with postgresql configuration (template1 doesn't
Date
Msg-id cvamr2$3s6$1@sea.gmane.org
Whole thread Raw
In response to Re: Having problem with postgresql configuration (template1 doesn't exist)?  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Having problem with postgresql configuration (template1 doesn't
List pgsql-admin
Tom Lane escreveu:
> 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
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
>

Thanks.

I tryed to create another data dir because I don't have the template1
database.

"# ls /var/lib/pgsql/data/base/1
1247   16386  16396  16406  16416  16601  16606  16611  16616  16621
16630  16635  16640  16647  16652
1249   16388  16398  16408  16418  16602  16607  16612  16617  16624
16631  16636  16641  16648  16653
1255   16390  16400  16410  16595  16603  16608  16613  16618  16625
16632  16637  16642  16649  pg_internal.init
1259   16392  16402  16412  16597  16604  16609  16614  16619  16626
16633  16638  16643  16650  PG_VERSION
16384  16394  16404  16414  16599  16605  16610  16615  16620  16629
16634  16639  16644  16651"

How to workaround this, please? Should I remove the /var/lib/pgsql/data
dir and create another with initdb command, please?

TIA,
Vinicius.

pgsql-admin by date:

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