Re: initdb problem

Поиск
Список
Период
Сортировка
От Joe Barwell
Тема Re: initdb problem
Дата
Msg-id 4679cd2e.22.42fc.1545812171@ihug.co.nz
обсуждение исходный текст
Ответ на initdb problem  (Joe Barwell <jbar@es.co.nz>)
Ответы Re: initdb problem  ("Phillip Smith" <phillip.smith@weatherbeeta.com.au>)
Список pgsql-admin
Hello People,

My thanks to the several people who gave suggestions for how
to solve my initdb problem.

1. "Phillip Smith" <phillip.smith@weatherbeeta.com.au>
suggested the problems stemmed from:

the 'postgres' user not having a correct shell login setup.
It looks like the home directory is set to /dev/null which
would explain all the "not a
directory" errors.

You'll need to edit the postgers user to have a proper login
shell
(/bin/bash maybe?).

I had previously been told something along these lines, and
so had already given postgres a shell of /bin/bash (using
NetInfo Manager). It is only since making that change that I
have been able to login as postgres at all. I note, however,
that postgres' home is still set to /dev/null, and would be
interested in trying to re-set that to something possibly
more useful, except I don't know what to use--any
suggestions, anyone?


2. "'James Herbers'" <james@herbers.ca> suggested:

as root you have to chown /Library/postgreSQL8/ -R (this is
what you do in Linux).

As shown below, the binary installer for pg 8.2.4 seemed to
already set that up correctly:

Acorn:/Library/PostgreSQL8 root# ls -l
total 0
drwxr-xr-x  27 postgres  admin  918 12 Jun 15:19 bin
drwx------   2 postgres  admin   68 11 Jun 08:10 data
drwxr-xr-x   3 postgres  admin  102 12 Jun 15:19 doc
drwxr-xr-x  21 postgres  admin  714 12 Jun 15:19 include
drwxr-xr-x  20 postgres  admin  680 12 Jun 15:19 lib
drwxr-xr-x   3 postgres  admin  102 11 Jun 08:10 log
drwxr-xr-x   4 postgres  admin  136 12 Jun 15:19 man
drwxr-xr-x   3 postgres  admin  102 12 Jun 15:19 share

James also suggested I should:

try this when changing to the postgres user:
    su - postgres
the hyphen gives you an environment for the postgres user.

Unfortunately, I either used the wrong syntax, or it doesn't
work for some other reason:

Acorn:/Library/PostgreSQL8 root# su - postgres
su: no directory

I wonder whether the above line, and the following, relate
to the lack of a home for the postgres user?

Acorn:/Library/PostgreSQL8 root# su postgres
su: /dev/null/.bashrc: Not a directory

3. Another list member suggested off-list that:

If you run the command as
`sudo su postgres -c 'initdb'`
then it should run the command as the postgres user but not
require the
postgres account to be a full account, which it requires if
you just do
su postgres and then run the command seperately...


But I got the following:

Acorn:/Library/PostgreSQL8 root# sudo su postgres -c
'initdb'
su: line 1: initdb: command not found

When I tried that again, but as acorn (my username) instead
of root, terminal more promisingly said I had to specify the
directory. What finally appeared to work, was the following:

Acorn acorn 3 acorn$ sudo su postgres -c 'initdb -D
/Library/PostgreSQL8/data'

This gave me a pid, but looking in Activity Monitor that pid
does not appear (nor anything else that looks like pg).

I note that the directory /Library/PostgreSQL8/data/ still
contains nothing, so for example this fails:

pg_ctl start -l logfile -D /Library/PostgreSQL8/data
pg_ctl: could not open PID file
"/Library/PostgreSQL8/data/postmaster.pid": Permission
denied

I earlier downladed & installed the
Postgres_Startup_Item.pkg, but either initdb didn't really
work, or there's some other problem.

I guess what I'm asking now is: how do I know if initdb has
worked, and what do I do next to start pg?

Sorry for the length.

Cheers!

Joe

В списке pgsql-admin по дате отправления:

Предыдущее
От: Scott Marlowe
Дата:
Сообщение: Re: [GENERAL] [PERFORM] Postgres VS Oracle
Следующее
От: "Phillip Smith"
Дата:
Сообщение: Re: initdb problem