[GRASSLIST:5970] Postgress and GRASS CD

I am having difficulty using postgres and grass gis. Is it installed with the cd?
I get the following error message

The following databases are in the Unix catalogue:
Error: select Postgres:could not connect to server: No such file or directory
         Is the server running locally and accepting
         connections on Unix domain socket "/tmp/.s.PGSQL.5432"?

Schuyler Fishman
Schuylerfish@earthlink.net
www.mindlikesky.com

I have been using Grass 4.3 and 5.0 from the Free GIS cd version 1.1. I
installed these programs from the rpms. It seems that neither postgresql
modules or nviz were installed from the rpms. I have been intending to
address this deficiency for a while but have not yet done so.

I would be interested in finding out if postgresql and nviz modules are
omitted in the rpm installation or if there is something that must be done
in the installation process to get the modules.

----- Original Message -----
From: "Schuyler Fishman" <schuylerfish@earthlink.net>
To: <support@openosx.com>
Cc: <grassLIST@baylor.edu>; <mario@mariomurphy.com>
Sent: Monday, April 07, 2003 9:27 AM
Subject: [GRASSLIST:5970] Postgress and GRASS CD

I am having difficulty using postgres and grass gis. Is it installed
with the cd?
I get the following error message

The following databases are in the Unix catalogue:
Error: select Postgres:could not connect to server: No such file or
directory
         Is the server running locally and accepting
         connections on Unix domain socket "/tmp/.s.PGSQL.5432"?

Schuyler Fishman
Schuylerfish@earthlink.net
www.mindlikesky.com

Hi,

I've been getting the exact same message using the OpenOSX CD. PostgreSQL _is_ installed by the CD and there are some notes on the CD about logging in and changing the postgres user password after installation.

I've also done some tinkering trying to start up new databases. I think I've managed to get postmaster up and running from the postgres account but i can't seem to connect to it - this is where I get your error message.

David Orme.

On Monday, April 7, 2003, at 05:27 pm, Schuyler Fishman wrote:

I am having difficulty using postgres and grass gis. Is it installed with the cd?
I get the following error message

The following databases are in the Unix catalogue:
Error: select Postgres:could not connect to server: No such file or directory
        Is the server running locally and accepting
        connections on Unix domain socket "/tmp/.s.PGSQL.5432"?

Schuyler Fishman
Schuylerfish@earthlink.net
www.mindlikesky.com

On Mon, Apr 07, 2003 at 09:43:08AM -0700, John Doucette wrote:

I have been using Grass 4.3 and 5.0 from the Free GIS cd version 1.1. I
installed these programs from the rpms.

It seems that neither postgresql
modules or nviz were installed from the rpms. I have been intending to
address this deficiency for a while but have not yet done so.

The FreeGIS CD 1.1.0 had the GRASS 5 parts that depend
on postgresql and opengl split out in extra rpm packages.
This makes installation easier for people not having postgresql
or opengl installed.

Thus you would have need to additionall install the rpms for this
from the CD as noted in the CD documentation.

  GRASS-OpenGL-5.0beta11cvs20010427p1-1.i386.rpm
  GRASS-postgreSQL-5.0beta11cvs20010427p1-1.i386.rpm

Note that the current FreeGIS-CD revision is 1.2.2:

  http://freegis.org/order.en.html

Best,
  Bernhard

Are you aware that you have to use the "-i" option on postmaster to use it
with Grass?

From "man postmaster""

-i This enables TCP/IP or Internet domain socket com-
        munication. Without this option, only local Unix
        domain socket communication is possible.

Despite what the man says, I have to use this option on the local host or
it will not connect.

----- Original Message -----
From: "David Orme" <d.orme@imperial.ac.uk>
To: "Schuyler Fishman" <schuylerfish@earthlink.net>
Cc: <grassLIST@baylor.edu>
Sent: Tuesday, April 08, 2003 5:07 AM
Subject: [GRASSLIST:5972] Re: Postgress and GRASS CD

Hi,

I've been getting the exact same message using the OpenOSX CD.
PostgreSQL _is_ installed by the CD and there are some notes on the CD
about logging in and changing the postgres user password after
installation.

I've also done some tinkering trying to start up new databases. I think
I've managed to get postmaster up and running from the postgres account
but i can't seem to connect to it - this is where I get your error
message.

David Orme.

On Monday, April 7, 2003, at 05:27 pm, Schuyler Fishman wrote:

> I am having difficulty using postgres and grass gis. Is it installed
> with the cd?
> I get the following error message
>
> The following databases are in the Unix catalogue:
> Error: select Postgres:could not connect to server: No such file or
> directory
> Is the server running locally and accepting
> connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
>
> Schuyler Fishman
> Schuylerfish@earthlink.net
> www.mindlikesky.com
>

cheg01@attbi.com wrote:

Are you aware that you have to use the "-i" option on postmaster to use it
with Grass?

>From "man postmaster""

-i This enables TCP/IP or Internet domain socket com-
        munication. Without this option, only local Unix
        domain socket communication is possible.

Despite what the man says, I have to use this option on the local host or
it will not connect.

The GRASS PostgreSQL programs shouldn't require postmaster to use the
"-i" switch (they work for me without it). However, ensure that you
*don't* have an entry for PG_HOST in the ~/.grassrc5 file.

AFAICT, once you specify a host, you can't subsequently specify a
local connection (i.e. via a Unix domain socket) other than by
manually removing the PG_HOST setting from ~/.grassrc5.

--
Glynn Clements <glynn.clements@virgin.net>

Schuyler Fishman wrote:

I am having difficulty using postgres and grass gis. Is it installed with the cd?
I get the following error message

The following databases are in the Unix catalogue:
Error: select Postgres:could not connect to server: No such file or directory
        Is the server running locally and accepting
        connections on Unix domain socket "/tmp/.s.PGSQL.5432"?

I don't know about the CD and about GRASS Postgres modules, however It seems to be a Postgres server configuration
problem (which is completely indipendent from GRASS).
If so, you should read the file "pg_hba.conf" (which is the main configuration file) and a bit of the html guide (that comes
with the package - you should have in your distro) (I have in "/usr/share/doc/postgresql-docs-7.2/admin.html" but you could have in another dir, (chapter 3 report your error)).
I have Postgres running via TCP/IP (locally - with loopback address)(if you are using Win. I suppose that Unix socket doesn't work :slight_smile: ), so supposing that you want to have the database in a dir diffrent from the default (for example in your ~) and you want to authenticate to the server with 'password' authentication method (It seems to me that pgaccess works only with this auth. method (if you want to use a GUI for the client)), this is how I have done (after a bit of 'try and error' - probable you could do in less steps) :

FIRST TIME: ° create dir for db_cluster (if you dont' use the default)
° root$ chown postgres db_cluster
° postgres$ initdb -D <cluster_dir> => pg_hba.conf, ecc.
° in pg_hba.conf:
    host all 127.0.0.1 255.255.255.255 trust
° httpd up:
  root$ apachectl start (if not running)
° postgres server up:
  postgres$ postmaster -D <cluster_dir> -i (the -i option is needed only if you use TCP/IP, as here)
° postgres$ createuser -h localhost <new_user_name>
° shutdown postmaster
° in pg_hba.conf:
  #host all 127.0.0.1 255.255.255.255 trust
   host all 127.0.0.1 255.255.255.255 password passwords_file
° postgres$ pg_password <new_passwords_file> (postgres passwords are different from login passwords, and if I remamber, they
                                                                              are encrypted, 'pg_password' utility menage them)
° server up:
  postgres$ postmaster -D <cluster_dir> -i
° graphical front to client side (if you want):
  user_you$ pgacces->Database ->open: template1
                        user: <that_created_with_createuser>
                        password: <that_created_with_pg_password>
           ->Database->new: <new_database> NEXT TIMES:
° httpd up:
  root$ apachectl start
° Postgres up:
  postgres$ postmaster -D <cluster_dir> -i
° graphical front to client side:
  user_you$ pgacces->Database ->open: <database>
                        user: <your_user>
                        password: <your_password>
  If you don't remamber the db_name:
  open: template1->Tables->pg_database (open and view available dbs)
  close
  open: known_db_name

Can some one who has experience getting Postgres interoperating with Grass on Mac OSX please post step by step instructions.

The initdb command will create a "data" directory, but the postgres server fails on startup. The initdb command requires su as the "postgres" user
  su postgres
  /usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data
complete successfully.

Several issues are apparent

1. Postmaster does not successufully start using the terminal command postmaster (eg.

   sudo -u postgres /usr/local/pgsql/bin/postmaster -i -D /usr/local/pgsql/data

this reports the error
  FATAL: no such group 'pgsql'
  /usr/local/pgsql/bin/postmaster: cannot create UNIX stream port
my interpretation: some parts of postmaster need write permission with group pgsql which is not created by MacOSX

2, attempting to open the postmaster with the command
   sudo -u pgsql /usr/local/pgsql/bin/postmaster -i -D /usr/local/pgsql/data
yield the error
  FATAL 1: cannot open /usr/local/pgsql/data/PG_VERSION: Permission denied
my interpretation: requires read permission of user "postgres" which is lacking for user pgsql

(I created the alternative user pgsql in an attempt to start postmaster)

3. attempting to start postmaster using the pg_ctl script as either user postgres or pgsql yields a similar error.

  sudo -u root sudo -u pgsql /usr/local/pgsql/bin/pg_ctl start -D /usr/local/pgsql/data
this returns a message
  postmaster successfully started
  FATAL 1: cannot open /usr/local/pgsql/data/PG_VERSION: Permission denied
same error as 2.

Evidently getting the postmaster/postgres server running need alterations of permissions and groups, but no documentation is available that explains how to create a "pgsql" group and associate it with a "postgres" user.

Changing the /usr/local/pgsql/data directory permissions to 777 or 766 yields an fatal error that permissions are incorrect: so simply expanding permissions doesn't work. The error reported is:
FATAL 1: data directory /usr/local/pgsql/data has group or world access; permissions should be u=rwx (0700)

trying to create a user from within postgres as in
  sudo -u postgres /usr/local/pgsql/bin/createuser jchesnut
fails because
  psql: could not connect to server: No such file or directory
            Is the server running locally and accepting
            connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
my interpretation: postmaster / postgres must be running before the createuser command can be issued. postgres wont run because of the fatal errors listed above.

Please help, if you know how to get postgres running under OSX

You need a postgres user and a postgres group on your system. For some reason the MySQL install (via Fink) creates the necessary user and group for itself, but Postgres doesn't.

If you have Mac OS X 10.2 or later, you can just add a line to your /etc/group file.
postgres:*:71:

The group number 71 works on my system, but if there's already a 71 in the group file, choose an unused number.
To add the user postgres, run sudo vipw. You get to edit the passwd file with vi.
Add something like
postgres:*:71:71:Postgresql Server:/nohome:/noshell

Again, if 71 is taken, use something else.
If you can't figure out vi, or don't have Jaguar, you're stuck with adding the user and group in NetInfo (/Applications/Utilities/NetInfo Manager)

Good Luck

Dave

On Tuesday, April 8, 2003, at 04:01 PM, John Chesnut wrote:

Can some one who has experience getting Postgres interoperating with Grass on Mac OSX please post step by step instructions.

The initdb command will create a "data" directory, but the postgres server fails on startup. The initdb command requires su as the "postgres" user
  su postgres
  /usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data
complete successfully.

Several issues are apparent

1. Postmaster does not successufully start using the terminal command postmaster (eg.

   sudo -u postgres /usr/local/pgsql/bin/postmaster -i -D /usr/local/pgsql/data

this reports the error
  FATAL: no such group 'pgsql'
  /usr/local/pgsql/bin/postmaster: cannot create UNIX stream port
my interpretation: some parts of postmaster need write permission with group pgsql which is not created by MacOSX

2, attempting to open the postmaster with the command
   sudo -u pgsql /usr/local/pgsql/bin/postmaster -i -D /usr/local/pgsql/data
yield the error
  FATAL 1: cannot open /usr/local/pgsql/data/PG_VERSION: Permission denied
my interpretation: requires read permission of user "postgres" which is lacking for user pgsql

(I created the alternative user pgsql in an attempt to start postmaster)

3. attempting to start postmaster using the pg_ctl script as either user postgres or pgsql yields a similar error.

  sudo -u root sudo -u pgsql /usr/local/pgsql/bin/pg_ctl start -D /usr/local/pgsql/data
this returns a message
  postmaster successfully started
  FATAL 1: cannot open /usr/local/pgsql/data/PG_VERSION: Permission denied
same error as 2.

Evidently getting the postmaster/postgres server running need alterations of permissions and groups, but no documentation is available that explains how to create a "pgsql" group and associate it with a "postgres" user.

Changing the /usr/local/pgsql/data directory permissions to 777 or 766 yields an fatal error that permissions are incorrect: so simply expanding permissions doesn't work. The error reported is:
FATAL 1: data directory /usr/local/pgsql/data has group or world access; permissions should be u=rwx (0700)

trying to create a user from within postgres as in
  sudo -u postgres /usr/local/pgsql/bin/createuser jchesnut
fails because
  psql: could not connect to server: No such file or directory
           Is the server running locally and accepting
           connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
my interpretation: postmaster / postgres must be running before the createuser command can be issued. postgres wont run because of the fatal errors listed above.

Please help, if you know how to get postgres running under OSX

John Chesnut wrote:

Can some one who has experience getting Postgres interoperating with Grass on Mac OSX please post step by step instructions.

I have Linux, maybe works the same.

sudo -u postgres /usr/local/pgsql/bin/postmaster -i -D /usr/local/pgsql/data

You don't need the the -i option if you use UNIX sockets. (You specify the type of connection
in pg_hba.conf).

this reports the error
FATAL: no such group 'pgsql'

On my system during the installation of postgres was created user 'postgres' that belong to
group 'postgres'.

Exuse my stupid question, but launching programs with 'sudo' is exatly the same as authenticating
before with 'su' (from a permission point of view) ?