Обсуждение: Install problems for postgresql-8.4.1

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

Install problems for postgresql-8.4.1

От
Don Fox
Дата:

Here is record of my attempt to do the install! I've used several sets of instructions for installing from src,  mainly  http://zanshin.net/2009/09/07/installing-postgresql-on-mac-10-6-snow-leopard/ which appears to be the clearest. 

Obviously something has been omitted! Any suggestions are greatly appreciated.  

This installation will be used with python and an opens source application 'GNUmed' used for electronic medical records.

Thanks,

Don


./configure --with-perl --with-python --with-openssl --with-bonjour PERL=/usr/bin/perl PYTHON=/usr/bin/python
 make
 sudo make install

Resulted with apparent success

PostgreSQL installation complete.

This is in .profile

if [ -d /usr/local/pgsql/bin ] ; then
     PATH="/usr/local/pgsql/bin:${PATH}"
fi
export PATH

I'm using 103

sudo dseditgroup -o create -i 102 -r "PostgreSQL Users" postgres

Shouldn't the following result in a postgres file under /Users?         
It doesn't!

sudo dscl . -create /Users/postgres
sudo dscl . -create /Users/postgres UniqueID 102
sudo dscl . -create /Users/postgres UserShell /bin/bash
sudo dscl . -create /Users/postgres RealName "Postgres Administrator"
sudo dscl . -create /Users/postgres NFSHomeDirectory /usr/local/pgsql
sudo dscl . -create /Users/postgres PrimaryGroupID 102
sudo dscl . -create /Users/postgres Password postgres
sudo chown -R postgres:postgres /usr/local/pgsql

Then did this and went tosystem prefs pane and reset Accounts for Postgres Admin to 'postgres'.

cd /usr/local/
...:local donfox1$ su postgres
Password:
bash-3.2$ whoami 
postgres

bash-3.2$ /usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.

The database cluster will be initialized with locale en_US.UTF-8.
The default database encoding has accordingly been set to UTF8.
The default text search configuration will be set to "english".

creating directory /usr/local/pgsql/data ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 32MB
creating configuration files ... ok
creating template1 database in /usr/local/pgsql/data/base/1 ... ok
initializing pg_authid ... ok
initializing dependencies ... ok
creating system views ... ok
loading system objects' descriptions ... ok
creating conversions ... ok
creating dictionaries ... ok
setting privileges on built-in objects ... ok
creating information schema ... ok
vacuuming database template1 ... ok
copying template1 to template0 ... ok
copying template1 to postgres ... ok

WARNING: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the -A option the
next time you run initdb.

Success. You can now start the database server using:

    /usr/local/pgsql/bin/postgres -D /usr/local/pgsql/data
or
    /usr/local/pgsql/bin/pg_ctl -D /usr/local/pgsql/data -l logfile start

bash-3.2$ 

bash-3.2$ /usr/local/pgsql/bin/pg_ctl -D /usr/local/pgsql/data -l logfile.log start
server starting
bash-3.2$ sh: logfile.log: Permission denied

But this works! 

bash-3.2$ pg_ctl -D /usr/local/pgsql/data status
pg_ctl: server is running (PID: 60134)
/usr/local/pgsql/bin/postgres "-D" "/usr/local/pgsql/data"
bash-3.2$ 


bash-3.2$  pg_ctl -D /usr/local/pgsql/data start  &
[1] 60129
bash-3.2$ server starting
LOG:  database system was shut down at 2009-11-01 11:49:21 EST
LOG:  autovacuum launcher started
LOG:  database system is ready to accept connections


However!
bash-3.2$ createdb testdb
Bus error


sh-3.2# ls -l
total 0
drwxr-xr-x  23 postgres  postgres   782 Nov  1 00:15 bin
drwx------  15 postgres  postgres   510 Nov  1 00:31 data
drwxr-xr-x  24 postgres  postgres   816 Nov  1 00:15 include
drwxr-xr-x  50 postgres  postgres  1700 Nov  1 00:15 lib
drwxr-xr-x  21 postgres  postgres   714 Nov  1 00:15 share


Re: Install problems for postgresql-8.4.1

От
Michael Wood
Дата:
2009/11/1 Don Fox <donfox1@mac.com>:
>
> Here is record of my attempt to do the install! I've used several sets of
> instructions for installing from src,  mainly
>  http://zanshin.net/2009/09/07/installing-postgresql-on-mac-10-6-snow-leopard/
> which appears to be the clearest.
> Obviously something has been omitted! Any suggestions are greatly
> appreciated.
[...]
> Shouldn't the following result in a postgres file under /Users?
> It doesn't!
> sudo dscl . -create /Users/postgres
[...]

No, I believe it's meant to create a user called postgres.  Those are
not filesystem paths.

> Then did this and went tosystem prefs pane and reset Accounts for Postgres
> Admin to 'postgres'.
> cd /usr/local/
> ...:local donfox1$ su postgres

It's usually best to use "su - username" and not just "su username".  See below.

> Password:
> bash-3.2$ whoami
> postgres
> bash-3.2$ /usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data
[...]
> Success. You can now start the database server using:
>     /usr/local/pgsql/bin/postgres -D /usr/local/pgsql/data
> or
>     /usr/local/pgsql/bin/pg_ctl -D /usr/local/pgsql/data -l logfile start
> bash-3.2$
> bash-3.2$ /usr/local/pgsql/bin/pg_ctl -D /usr/local/pgsql/data -l
> logfile.log start
> server starting
> bash-3.2$ sh: logfile.log: Permission denied

If you run "pwd" now, you should see that you are in your home
directory instead of somewhere that the "postgres" user can write this
log file.  Instead of using "su postgres" above, you could have run
"su - postgres" to put you in the postgres user's home directory
(/usr/local/pgsql) which should be writable.  Otherwise specify
somewhere else to create the log file where the postgres user has
write access.  e.g. /usr/local/pgsql/bin/pg_ctl -D
/usr/local/pgsql/data -l /path/to/logfile start

> But this works!
> bash-3.2$ pg_ctl -D /usr/local/pgsql/data status
> pg_ctl: server is running (PID: 60134)
> /usr/local/pgsql/bin/postgres "-D" "/usr/local/pgsql/data"
> bash-3.2$
>
> bash-3.2$  pg_ctl -D /usr/local/pgsql/data start  &
> [1] 60129
> bash-3.2$ server starting
> LOG:  database system was shut down at 2009-11-01 11:49:21 EST
> LOG:  autovacuum launcher started
> LOG:  database system is ready to accept connections
>
> However!
> bash-3.2$ createdb testdb
> Bus error

I don't know what would cause a Bus error here.  Everything up to this
point seems fine.  Can you connect to the database using "psql"?

--
Michael Wood <esiotrot@gmail.com>

Re: Install problems for postgresql-8.4.1

От
Don Fox
Дата:
I think the hitch is something on my  machine( an old Intel Core Duo) MacBook Pro. When I do a :

 dscl . -list /Groups PrimaryGroupID | awk '{print $2 $1}' | sort -n

I get

-2nobody
-1nogroup
0wheel
UsersPostgreSQL    <------------- Looks strange to me! Should it be removed?   THis is after previous installation is removed and I've just done a new 'sudo make install'.
1daemon
2kmem
3sys
4tty
5operator
 

When I use the
sudo dseditgroup -o create -i 103 -r "PostgreSQL Users" postgres

I get

Create called on existing record - do you want to overwrite, y or n : 

In this case 103 should be avaliable as it's not in either Users Unique ID or in Groups Primary ID

No matter which avaliable number I choose I still get the same response and any createdb attempt results in a bus error!

Don


On Nov 1, 2009, at 8:48 PM, Mark H. Nichols wrote:

Don,

On Nov 1, 2009, at 7:19 PM, Don Fox wrote:

What kind of new Mac do you have? 

I just got a Unibody 15" MacBook Pro with the 2.66 GHz processors and a 320 GB hard drive. Also the matte (anti-glare) screen. Very nice replacement for my aging PowerBook G4.


I'm looking forward to an iMac with i7 cpu when they become  available!

No offense, but having spent my money I'm hoping that's a little later rather than sooner. :)


I'm going to give this another try now, Thanks for the nifty tool.

By the way, should sudo dscl . -create /Users/postgres  create another user under /Users ?

I see the Postgres user in the list of accounts in Accounts pane of System Preferences, but there is not a new entry in the /Users directory. By setting the home directory to /usr/local/pgsql (sudu dscl . -create /Users/postgres NFSHomeDirectory /usr/local/pgsql
) we didn't create a directory in /Users.

Mark


Re: Install problems for postgresql-8.4.1

От
Michael Wood
Дата:
2009/11/2 Don Fox <donfox1@mac.com>:
> I think the hitch is something on my  machine( an old Intel Core Duo)
> MacBook Pro. When I do a :
>  dscl . -list /Groups PrimaryGroupID | awk '{print $2 $1}' | sort -n
> I get
> -2nobody
> -1nogroup
> 0wheel
> UsersPostgreSQL    <------------- Looks strange to me! Should it be removed?
>   THis is after previous installation is removed and I've just done a new
> 'sudo make install'.
[...]

The output would look much clearer if you left off the awk and the
sort.  If you really want it sorted you can do it without using awk
first.

e.g.:

$ dscl . -list /Groups PrimaryGroupID | sort -nk2

Your output implies that the Primary Group ID field for the PostgreSQL
group is "Users" when it should be a number.  Actually it could just
be that the group name is "PostgreSQL Users" and the group ID isn't
being shown because your command only outputs the first two fields,
which are "PostgreSQL Users".  So try this instead:

$ dscl . -list /Groups PrimaryGroupID | grep -i postgres

> When I use the
>
> sudo dseditgroup -o create -i 103 -r "PostgreSQL Users" postgres
>
> I get
> Create called on existing record - do you want to overwrite, y or n :
> In this case 103 should be avaliable as it's not in either Users Unique ID
> or in Groups Primary ID
> No matter which avaliable number I choose I still get the same response and
> any createdb attempt results in a bus error!

I suspect you will need to remove the "PostgreSQL" or "PostgreSQL
Users" group and the "postgres" group if it exists and try to create
the postgres group again.

It seems unlikely that those are causing the bus error, though.

Can you connect to the template1 database using psql?

--
Michael Wood <esiotrot@gmail.com>

Re: Install problems for postgresql-8.4.1

От
Don Fox
Дата:
I still get the bus error!

bash-3.2$ /usr/local/pgsql/bin/pg_ctl -D /usr/local/pgsql/data -l logfile start
server starting
bash-3.2$ createdb -T template1 fromtemp0db
Bus error
bash-3.2$ 


On Nov 2, 2009, at 10:54 AM, Michael Wood wrote:

2009/11/2 Don Fox <donfox1@mac.com>:
I think the hitch is something on my  machine( an old Intel Core Duo)
MacBook Pro. When I do a :
 dscl . -list /Groups PrimaryGroupID | awk '{print $2 $1}' | sort -n
I get
-2nobody
-1nogroup
0wheel
UsersPostgreSQL    <------------- Looks strange to me! Should it be removed?
  THis is after previous installation is removed and I've just done a new
'sudo make install'.
[...]

The output would look much clearer if you left off the awk and the
sort.  If you really want it sorted you can do it without using awk
first.

e.g.:

$ dscl . -list /Groups PrimaryGroupID | sort -nk2

Your output implies that the Primary Group ID field for the PostgreSQL
group is "Users" when it should be a number.  Actually it could just
be that the group name is "PostgreSQL Users" and the group ID isn't
being shown because your command only outputs the first two fields,
which are "PostgreSQL Users".  So try this instead:

$ dscl . -list /Groups PrimaryGroupID | grep -i postgres

When I use the

sudo dseditgroup -o create -i 103 -r "PostgreSQL Users" postgres

I get
Create called on existing record - do you want to overwrite, y or n :
In this case 103 should be avaliable as it's not in either Users Unique ID
or in Groups Primary ID
No matter which avaliable number I choose I still get the same response and
any createdb attempt results in a bus error!

I suspect you will need to remove the "PostgreSQL" or "PostgreSQL
Users" group and the "postgres" group if it exists and try to create
the postgres group again.

It seems unlikely that those are causing the bus error, though.

Can you connect to the template1 database using psql?

--
Michael Wood <esiotrot@gmail.com>

--
Sent via pgsql-novice mailing list (pgsql-novice@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-novice

Re: Install problems for postgresql-8.4.1

От
Tom Lane
Дата:
Don Fox <donfox1@mac.com> writes:
> bash-3.2$ createdb -T template1 fromtemp0db
> Bus error
> bash-3.2$

This appears to be the createdb program itself crashing, not the server.
That cuts down the alternatives quite a lot, because createdb isn't
much; it basically just tries to connect via libpq and send a CREATE
DATABASE command to the server.  My first thought is that you have a
corrupt libpq.so, or one that is incompatible with your createdb
executable.  You could check some of the more obvious causes by
seeing what "file" and "otool -L" have to say about createdb and
libpq.so.

            regards, tom lane

Re: Install problems for postgresql-8.4.1

От
Michael Wood
Дата:
2009/11/2 Mark H. Nichols <info@markhnichols.com>:
>
> On Nov 2, 2009, at 1:39 PM, Tom Lane wrote:
>
>> Don Fox <donfox1@mac.com> writes:
>>>
>>> bash-3.2$ createdb -T template1 fromtemp0db
>>> Bus error
>>> bash-3.2$

Yes, I'm not surprised.

>> This appears to be the createdb program itself crashing, not the server.
>> That cuts down the alternatives quite a lot, because createdb isn't
>> much; it basically just tries to connect via libpq and send a CREATE
>> DATABASE command to the server.  My first thought is that you have a
>> corrupt libpq.so, or one that is incompatible with your createdb
>> executable.  You could check some of the more obvious causes by
>> seeing what "file" and "otool -L" have to say about createdb and
>> libpq.so.
>>
>>                        regards, tom lane
>
> Would a potentially corrupt createdb program indicate that the download of
> Postrgres was somehow corrupt? Can you download the checksum and verify that
> your download is complete and undamaged?

No, it's highly unlikely to have compiled if it was corrupt.  It's
more likely something like an old version of libpq being used by
createdb as Tom seems to imply.

Don, do any of the other commands work?  e.g. psql?  Or createuser?

--
Michael Wood <esiotrot@gmail.com>

Re: Install problems for postgresql-8.4.1

От
Don Fox
Дата:

On Nov 2, 2009, at 3:43 PM, Michael Wood wrote:

2009/11/2 Mark H. Nichols <info@markhnichols.com>:

On Nov 2, 2009, at 1:39 PM, Tom Lane wrote:

Don Fox <donfox1@mac.com> writes:

bash-3.2$ createdb -T template1 fromtemp0db
Bus error
bash-3.2$

Yes, I'm not surprised.

This appears to be the createdb program itself crashing, not the server.
That cuts down the alternatives quite a lot, because createdb isn't
much; it basically just tries to connect via libpq and send a CREATE
DATABASE command to the server.  My first thought is that you have a
corrupt libpq.so, or one that is incompatible with your createdb
executable.  You could check some of the more obvious causes by
seeing what "file" and "otool -L" have to say about createdb and
libpq.so.

                       regards, tom lane

Would a potentially corrupt createdb program indicate that the download of
Postrgres was somehow corrupt? Can you download the checksum and verify that
your download is complete and undamaged?

No, it's highly unlikely to have compiled if it was corrupt.  It's
more likely something like an old version of libpq being used by
createdb as Tom seems to imply.

Don, do any of the other commands work?  e.g. psql?  Or createuser?

createuser seems ok but psql is not recognized. I did a 'find' to locate the libpg.so but couldn't locate it. Could someone tell me where it is.

Don




--
Michael Wood <esiotrot@gmail.com>

--
Sent via pgsql-novice mailing list (pgsql-novice@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-novice

Re: Install problems for postgresql-8.4.1

От
Don Fox
Дата:
I have done a find from root and can't locate libpg.so!
Does someone know where it's supposed to reside?

Don

On Nov 2, 2009, at 2:41 PM, Mark H. Nichols wrote:

>
> On Nov 2, 2009, at 1:39 PM, Tom Lane wrote:
>
>> Don Fox <donfox1@mac.com> writes:
>>> bash-3.2$ createdb -T template1 fromtemp0db
>>> Bus error
>>> bash-3.2$
>>
>> This appears to be the createdb program itself crashing, not the
>> server.
>> That cuts down the alternatives quite a lot, because createdb isn't
>> much; it basically just tries to connect via libpq and send a CREATE
>> DATABASE command to the server.  My first thought is that you have a
>> corrupt libpq.so, or one that is incompatible with your createdb
>> executable.  You could check some of the more obvious causes by
>> seeing what "file" and "otool -L" have to say about createdb and
>> libpq.so.
>>
>>             regards, tom lane
>
> Would a potentially corrupt createdb program indicate that the
> download of Postrgres was somehow corrupt? Can you download the
> checksum and verify that your download is complete and undamaged?
>
> Mark
>


Re: Install problems for postgresql-8.4.1

От
Tom Lane
Дата:
Don Fox <donfox1@mac.com> writes:
> I have done a find from root and can't locate libpg.so!
> Does someone know where it's supposed to reside?

On a Mac it's actually going to be .dylib --- sorry about saying .so.
You should have something like

-rwxr-xr-x   1 tgl  admin  166520 Oct  2 23:51 libpq.5.3.dylib*
lrwxr-xr-x   1 tgl  admin      15 Oct  2 23:51 libpq.5.dylib@ -> libpq.5.3.dylib
lrwxr-xr-x   1 tgl  admin      15 Oct  2 23:51 libpq.dylib@ -> libpq.5.3.dylib

where the numbers will vary depending on which PG release we're
talking about.

            regards, tom lane

Re: Install problems for postgresql-8.4.1

От
Don Fox
Дата:

'sudo find . -name 'libpg*.dylib' -print' at / 

Produced only this:

./usr/local/pgsql/lib/libpgtypes.3.1.dylib
./usr/local/pgsql/lib/libpgtypes.3.dylib
./usr/local/pgsql/lib/libpgtypes.dylib

At this point Im mystified!? I think the commands I'm using for installation are correct. The bus error I get from creatdb must be something to do with my machine?

Any suggestions? This must be doable.

Thanks,
Don


On Nov 2, 2009, at 11:35 PM, Tom Lane wrote:

Don Fox <donfox1@mac.com> writes:
I have done a find from root and can't locate libpg.so!
Does someone know where it's supposed to reside?

On a Mac it's actually going to be .dylib --- sorry about saying .so.
You should have something like

-rwxr-xr-x   1 tgl  admin  166520 Oct  2 23:51 libpq.5.3.dylib*
lrwxr-xr-x   1 tgl  admin      15 Oct  2 23:51 libpq.5.dylib@ -> libpq.5.3.dylib
lrwxr-xr-x   1 tgl  admin      15 Oct  2 23:51 libpq.dylib@ -> libpq.5.3.dylib

where the numbers will vary depending on which PG release we're
talking about.

regards, tom lane

Re: Install problems for postgresql-8.4.1

От
Don Fox
Дата:
Success at last!!!

I downloades a new tarball from sourceforge; this time selecting the  tar.bz2 compression scheme.  Previously I always used the tar.gz out of habit.
The install went off without a hitch! 
Something is off about some of these tar files.
Many thanks for all the help! 

Don

On Nov 2, 2009, at 11:35 PM, Tom Lane wrote:

Don Fox <donfox1@mac.com> writes:
I have done a find from root and can't locate libpg.so!
Does someone know where it's supposed to reside?

On a Mac it's actually going to be .dylib --- sorry about saying .so.
You should have something like

-rwxr-xr-x   1 tgl  admin  166520 Oct  2 23:51 libpq.5.3.dylib*
lrwxr-xr-x   1 tgl  admin      15 Oct  2 23:51 libpq.5.dylib@ -> libpq.5.3.dylib
lrwxr-xr-x   1 tgl  admin      15 Oct  2 23:51 libpq.dylib@ -> libpq.5.3.dylib

where the numbers will vary depending on which PG release we're
talking about.

regards, tom lane

--
Sent via pgsql-novice mailing list (pgsql-novice@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-novice

Re: Install problems for postgresql-8.4.1

От
Michael Wood
Дата:
2009/11/4 Don Fox <donfox1@mac.com>:
>
> 'sudo find . -name 'libpg*.dylib' -print' at /
> Produced only this:

It's libpQ, not libpG.

--
Michael Wood <esiotrot@gmail.com>

Re: Install problems for postgresql-8.4.1

От
"Mark H. Nichols"
Дата:
Don,

I just ran through the steps I captured on my blog again, on a new machine that had never had PostgreSQL installed before. I was able to complete everything with no problems. In doing so I discovered a couple formatting errors on my blog that prevented all the step details from appearing. I've corrected the formatting and now all the details for each steps appears completely. 

I also added a link at the bottom of the posting for pgAdmin, a GUI tool for administering PostgreSQL databases. You can find the download here: http://www.pgadmin.org/.

I wonder if installing that tool would allow you to create databases and get your installation working.


On Nov 1, 2009, at 11:18 AM, Don Fox wrote:


I'm using 103

sudo dseditgroup -o create -i 102 -r "PostgreSQL Users" postgres

Shouldn't the following result in a postgres file under /Users?         
It doesn't!

sudo dscl . -create /Users/postgres
sudo dscl . -create /Users/postgres UniqueID 102
sudo dscl . -create /Users/postgres UserShell /bin/bash
sudo dscl . -create /Users/postgres RealName "Postgres Administrator"
sudo dscl . -create /Users/postgres NFSHomeDirectory /usr/local/pgsql
sudo dscl . -create /Users/postgres PrimaryGroupID 102
sudo dscl . -create /Users/postgres Password postgres
sudo chown -R postgres:postgres /usr/local/pgsql

You say you are using 103, but in the statements you copied into your email you used 102. It shouldn't matter which you used, as long as you were consistent throughout.


bash-3.2$ /usr/local/pgsql/bin/pg_ctl -D /usr/local/pgsql/data -l logfile.log start
server starting
bash-3.2$ sh: logfile.log: Permission denied

What directory were you in when you ran the pg_ctl? If you weren't in /usr/local/pgsql you would get a permissions error trying to create the the logfile.


However!
bash-3.2$ createdb testdb
Bus error

I have no idea what is causing this error.


mark


Re: Install problems for postgresql-8.4.1

От
"Mark H. Nichols"
Дата:
On Nov 2, 2009, at 1:39 PM, Tom Lane wrote:

> Don Fox <donfox1@mac.com> writes:
>> bash-3.2$ createdb -T template1 fromtemp0db
>> Bus error
>> bash-3.2$
>
> This appears to be the createdb program itself crashing, not the
> server.
> That cuts down the alternatives quite a lot, because createdb isn't
> much; it basically just tries to connect via libpq and send a CREATE
> DATABASE command to the server.  My first thought is that you have a
> corrupt libpq.so, or one that is incompatible with your createdb
> executable.  You could check some of the more obvious causes by
> seeing what "file" and "otool -L" have to say about createdb and
> libpq.so.
>
>             regards, tom lane

Would a potentially corrupt createdb program indicate that the
download of Postrgres was somehow corrupt? Can you download the
checksum and verify that your download is complete and undamaged?

Mark


Re: Install problems for postgresql-8.4.1

От
"Mark H. Nichols"
Дата:
Congratulations!

Mark


On Nov 3, 2009, at 9:39 PM, Don Fox wrote:

Success at last!!!

I downloades a new tarball from sourceforge; this time selecting the  tar.bz2 compression scheme.  Previously I always used the tar.gz out of habit.
The install went off without a hitch! 
Something is off about some of these tar files.
Many thanks for all the help!