From owner-freebsd-questions Tue May 25 21:12:31 1999 Delivered-To: freebsd-questions@freebsd.org Received: from spider1.spiderlink.com (unknown [207.155.120.89]) by hub.freebsd.org (Postfix) with ESMTP id 20A751501A for ; Tue, 25 May 1999 21:12:26 -0700 (PDT) (envelope-from jim@freeze.org) Received: from zw9js (terbium.remote.qx.net [208.200.110.122]) by spider1.spiderlink.com (post.office MTA v2.0 0813 ID# 0-29967U60) with SMTP id AAB268 for ; Tue, 25 May 1999 21:11:59 -0700 Message-ID: <031f01bea72d$f3a50e00$5e6ec8d0@lexmark.com> From: "Jim Freeze" To: References: <199905260157.UAA16630@nospam.hiwaay.net> Subject: Re: Installing and Running PostgreSQL on FreeBSD 3.1 Date: Wed, 26 May 1999 00:10:32 -0400 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.00.2314.1300 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > jfreeze@lexmark.com writes: > > I trying to get postgres-6.0.4 working on FreeBSD 3.1. I installed > ^^^^^ 6.4.2 ??? Yes, I was doing this from memory (still am). It was something like 6.4.2 in the directory listing and installed two upgrades to get 6.4.4 ?? > 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. :-) Instead of `pkg_delete` should I use `make deinstall` since I used `make install` to install it? Also, what is the advantage of using TCL. I plan on using PHP3 for my main access to the databases. Or am I missing the point? > > 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. Sure. > > > 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. > What does within PostgreSQL mean. Are these user accounts not BSD user accounts. > 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. > Wow. Thanks for the walk through. I really appreciate it. BTW, concerning this user business. How does that apply when someone accesses the db through a web page (Apache+PHP3). Is this what is meant by network access below? > 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 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message