Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 25 May 1999 20:57:00 -0500
From:      David Kelly <dkelly@hiwaay.net>
To:        jfreeze@lexmark.com
Cc:        freebsd-questions@FreeBSD.ORG, pgsql-novice@postgreSQL.org
Subject:   Re: Installing and Running PostgreSQL on FreeBSD 3.1 
Message-ID:  <199905260157.UAA16630@nospam.hiwaay.net>
In-Reply-To: Message from jfreeze@lexmark.com  of "Tue, 25 May 1999 16:24:25 EDT." <199905252025.AA23818@interlock2.lexmark.com> 

next in thread | previous in thread | raw e-mail | index | archive | help
jfreeze@lexmark.com writes:
> I trying to get postgres-6.0.4 working on FreeBSD 3.1. I installed
                           ^^^^^ 6.4.2 ???
Version 6.4.2 has in ports since at least April 22. Maybe 6.4.0 was in 
FreeBSD 3.1-RELEASE? I could check but its not really important other 
than a 6.0 release it pretty old.

> from the ports collection from the Walnut Creek 4 CDROM set.

Good! That's the right way to do it. Now you might wish to pkg_delete 
it and do it again using "make USE_TCL=true install" then follow up by 
installing the pgaccess port.  :-)

Pgaccess is in PostgreSQL 6.4.2 but the port contains a newer version, 
*and* installs pgaccess correctly. Believe the PostgreSQL port was 
recently fixed to *not* install its pgaccess.

> Why is the data directory set to drwx-------?

Mike Smith already answered. The pgsql account does *all* of the access 
to these files, therefore there is no reason for anybody else to be 
able to read them. If you *really* want to get into PostgreSQL you can 
create your own database files elsewhere and launch your own instances 
of the front and back ends. That's not for the faint of heart. I've 
never tried to do it, but the docs mention it.

The port installs /usr/local/etc/rc.d/pgsql.sh which automatically 
starts PostgreSQL on reboot. Simply execute it as root to start the 
first time. Or reboot.

> What went wrong?
> Although I have read several docs, I am a newby and am not sure what
> to expect here.

You have to make account(s) within PostgreSQL for those you wish to 
allow to access the SQL system.

But first, the man pages. PostgreSQL put them in /usr/local/pgsql/man. 
So add that to your MANPATH so it looks something like this:

% echo $MANPATH
/usr/share/man:/usr/X11R6/man:/usr/local/man
% setenv MANPATH ${MANPATH}:/usr/local/pgsql/man
% !e
echo $MANPATH
/usr/share/man:/usr/X11R6/man:/usr/local/man:/usr/local/pgsql/man

While you are at it, add /usr/local/pgsql/bin to path:

% set path=($path /usr/local/pgsql/bin)

Naturally you'll want to put these in ~/.cshrc so you don't have to 
type them every time. You could also edit /etc/manpath.conf and
/etc/csh.cshrc to apply the changes to all users without need of 
changing all .cshrc files.

Now you can read man pages. But first we'll try to create a new database
to play with:

% createdb my_database
Connection to database 'template1' failed.
FATAL 1:  SetUserId: user 'dkelly' is not in 'pg_shadow'

createdb: database creation failed on my_database.
% su
# su -m pgsql
% id
uid=70(pgsql) gid=70(pgsql) groups=70(pgsql)
% createuser dkelly
createuser: Command not found.

Darn it. Thought "su -m" was going to solve that problem.

% echo $path
/home/dkelly/bin /bin /usr/bin /usr/games /usr/local/bin /usr/X11R6/bin /usr/sbin /sbin
% set path=($path /usr/local/pgsql/bin)
% createuser dkelly 
Enter user's postgres ID or RETURN to use unix user ID: 928 -> 
Is user "dkelly" allowed to create databases (y/n) y
Is user "dkelly" allowed to add users? (y/n) y
createuser: dkelly was successfully added
% exit
# exit
% !creat
createdb my_database
% psql my_database
Welcome to the POSTGRESQL interactive sql monitor:
  Please read the file COPYRIGHT for copyright terms of POSTGRESQL

   type \? for help on slash commands
   type \q to quit
   type \g or terminate with semicolon to execute query
 You are currently connected to the database: my_database

my_database=> \q
%

Will let you take over from here. You can do more to the user accounts
(such as set passwords for network access) if you "psql template1" from
the pgsql account.

For network access you need to work on editing 
/usr/local/pgsql/data/pg_hba.conf to decide who/where/how you allow 
connections.

> (A BSD admin question)
> Also, the docs seem to suggest that I need to be logged in as
> user pgsql to start the postmaster. I tried to create this user account
> but it said that it already existed. I don't remember making it, but
> if I did, how do I manually delete it and recreate it (since I don't
> know the password for that user).

Already covered in the above example. You can set a password for pgsql,
and/or you can get there thru root as I did above. The # prompt above
indicates root. % is a non-root user.


--
David Kelly N4HHE, dkelly@nospam.hiwaay.net
=====================================================================
The human mind ordinarily operates at only ten percent of its
capacity -- the rest is overhead for the operating system.




To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199905260157.UAA16630>