# Want Postgres Server to start on boot...

## Floog

Upon completing installation of Postgres, I did # rc-update add postgresql default

But postgres fails to start properly upon boot.

First I got this error -

postmaster cannot access the server configuration file "/var/lib/postgresql/data/postgresql.conf": No such file or directory

FATAL:  could not open configuration file "/var/lib/postgresql/data/postgresql.conf": Permission denied

Okay, so I copied my postgresql.conf from /usr/local/postgresql to /var/lib/postgresql/data

and then rebooted

Then I got this error - 

FATAL:  data directory "/var/lib/postgresql/data" has group or world access

DETAIL:  Permissions should be u=rwx (0700).

Ahh, well that was very thoughtful of Postgres to give me that hint.  So I chown -R postgres /var/lib/postgresql and then rebooted.

Then I got this error -

FATAL:  "/var/lib/postgresql/data" is not a valid data directory

DETAIL:  File "/var/lib/postgresql/data/PG_VERSION" is missing.

And now I'm seeing a pattern.  It just seems like I have everything setup in the wrong directories for postgres to start properly upon bootup.  I initially configured my PG_DATA directory and everything else to go in /usr/local/postgresql.

But it seems like postgresql wants everything to occur in /var/lib/postgresql.

How do I go from this point forward to get Postgresql to start properly upon boot.

Thanks for your help and patience.

----------

## limn

Something like:

A. Edit /etc/conf.d/postgresql and change PGDATA to /usr/local/postrgresql/data.

or

B. 

```
su - postgres

cp -pr /usr/local/postgresql/* /var/lib/postgresql/data/
```

If you chose A, you will need to watch for future postgresql emerges having a config  that will change it back on an etc-update, etc.

Run

```
/etc/init.d/postgresql start
```

as root to verify it will come up correctly with your changes, before rebooting again.

----------

## Floog

Nice work, Limn!

And speedy reply too.   :Smile: 

I really appreciate the help getting postgresql off the ground.

I chose "A" and it's up and running upon reboot.

I'll be sure to remember to check /etc/conf.d/postgresql upon any emerges of postgresql.

----------

