Обсуждение: Upgrading to 8.4

Поиск
Список
Период
Сортировка

Upgrading to 8.4

От
bill house
Дата:
Hello,

Upgrading from 8.3 to 8.4 on a Mandriva distro.

I downloaded the source and unpacked.  I tried to follow the short
instructions in the INSTALL file to the letter.

As root (first mistake?) I configured, compiled and installed
taking the default location for data and binaries,
Switched user to postgres & created the directories as instructed.
Started the server.
Server is running.
As postgres, I can run psql and connect to the server.

But I am encountering some problems, the most basic one being permission
issues.

For example, postgres can't do a pg_dump (even though it could start the
server),

    bash$ pg_dump > pg_dump_test.sql
         bash$ pg_dump_test.sql: permission denied

I am thinking this is a write permissions issue in the directory he is
in but I can't be sure because he can write to his .psql_history file in
the same directory.

Mandriva's location for things was:

    data         /var/lib/pgsql
    binaries     /usr/bin
    postgres' home     /var/lib/pgsql

When setting this up I retained the practice of having postres' home the
working directory of the server

    /usr/local/pgsql:

So an ls -la in this area looks like so:

********************************************************
Sun Feb 21 20:01:20
root on pts/5 barney2.test.lcl:/usr/local/pgsql
# l
total 78656
drwxr-xr-x  7 root     root         4096 2010-02-21 19:14 .
drwxr-xr-x 13 root     root         4096 2010-02-21 17:12 ..
-rw-r--r--  1 postgres postgres      467 2010-02-21 19:08 .bash_profile
drwxr-xr-x  2 root     root         4096 2010-02-21 17:13 bin
drwx------ 11 postgres root         4096 2010-02-21 18:09 data
drwxr-xr-x  6 root     root         4096 2010-02-21 17:13 include
drwxr-xr-x  3 root     root         4096 2010-02-21 17:13 lib
-rw-r--r--  1 postgres postgres 80419764 2010-02-21 19:26
                                                         pg_dumpall_20100219.sql
-rw-r--r--  1 postgres postgres       14 2010-02-21 19:17 .psql_history
drwxr-xr-x  7 root     root         4096 2010-02-21 17:13 share


So I have several questions related to the permission problem(s):

1) Is is necessary/wise/secure to have postgres' home directory the
working area of the server? If not, what is a recommended alternative
home?

2) After the installation, the owner/group of these files should be?

3) Is there a startup script for inclusion in /etc/init.d contained in
the source code package? If so which is it?

My ultimate goal is to read the pg_dumpall_20100219.sql into the server.
  My attempts to do so have so far failed but that problem can't be
solved until the more basic ones are.

Re: Upgrading to 8.4

От
Tom Lane
Дата:
bill house <wchouse@bellsouth.net> writes:
> root on pts/5 barney2.test.lcl:/usr/local/pgsql
> # l
> total 78656
> drwxr-xr-x  7 root     root         4096 2010-02-21 19:14 .
> drwxr-xr-x 13 root     root         4096 2010-02-21 17:12 ..
> -rw-r--r--  1 postgres postgres      467 2010-02-21 19:08 .bash_profile
> drwxr-xr-x  2 root     root         4096 2010-02-21 17:13 bin
> drwx------ 11 postgres root         4096 2010-02-21 18:09 data
> drwxr-xr-x  6 root     root         4096 2010-02-21 17:13 include
> drwxr-xr-x  3 root     root         4096 2010-02-21 17:13 lib
> -rw-r--r--  1 postgres postgres 80419764 2010-02-21 19:26
>                                                          pg_dumpall_20100219.sql
> -rw-r--r--  1 postgres postgres       14 2010-02-21 19:17 .psql_history
> drwxr-xr-x  7 root     root         4096 2010-02-21 17:13 share

Not sure how you got into that state, but having postgres' home
directory owned by root isn't a particularly good idea.  The same
statement would apply for any non-root account.

> 1) Is is necessary/wise/secure to have postgres' home directory the
> working area of the server? If not, what is a recommended alternative
> home?

The data directory can be anywhere as long as it's owned by the postgres
user.

> 2) After the installation, the owner/group of these files should be?

See above.

> 3) Is there a startup script for inclusion in /etc/init.d contained in
> the source code package? If so which is it?

You can look in contrib/start-scripts, but that script is pretty crude.
In most cases it would be better to borrow the postgres start script
used by whatever distro you're on.

            regards, tom lane