Re: Need for "Getting Started" Tutorial

From: David Fetter <david(at)fetter(dot)org>
To: Joshua Kramer <josh(at)globalherald(dot)net>
Cc: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>, Chris Browne <cbbrowne(at)acm(dot)org>, pgsql-advocacy(at)postgresql(dot)org
Subject: Re: Need for "Getting Started" Tutorial
Date: 2007-05-02 19:29:05
Message-ID: 20070502192905.GA31318@fetter.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-advocacy

On Wed, May 02, 2007 at 02:39:58PM -0400, Joshua Kramer wrote:
>
> >Hmmm, that depends really. I rarely run into people wanting PostgreSQL
> >help that ran MySQL. I often run into people that want PostgreSQL help
> >that ran Oracle or MSSQL (oddly not much DB2).
>
> Ok, here's something I nabbed from one of my LJ articles. Still a little
> rough around the edges but a good start:
>
> Configuring PostgreSQL
>
> In this document, I'll describe how to get Postgres up and running on
> Linux. When you're done reading, you should have a Postgres server
> configured with
> one login user and a database belonging to that user. (At this point, I'm
> assuming that you've either compiled and installed from source or installed
> from binary packages.)
>
> Because of the different filesystem structures available to Unix and Linux
> users, the first step you should perform after installation is determine
> where Postgres lives. You can do this with a command like the following:
>
> su -c "find / -name pg_hba.conf"

You might try

su -c 'locate pg_hba.conf'

first.

> When the command stops running, make note of the result, which may look
> like:
>
> /opt/pgsql/data/pg_hba.conf
>
> As it is configured after a default installation, PostgreSQL authenticates
> its users by checking their Linux identities. To create a more secure
> application, you should change this to password authentication. The
> following steps describe how to do so. Before you begin, change to the
> directory you found above. This directory contains a number of files that
> we'll have to edit.
>
> First, modify the password of the database user postgres so that you can log
> in when passwords are required:
>
> 1. At a command prompt, type su and enter your root password.
> 2. Then, type su postgres.

That should read

su - postgres

in order to pick up environment settings, etc. Also note that on some
of the *BSDs, the user is called pgsql, not postgres.

> 3. Now, start the psql monitor by typing psql template1.

In modern versions of PostgreSQL, it's just psql

> 4. We modify the password by typing alter user postgres with
> password 'pgUser89' or some other suitable password.

That's probably not a good one, but choosing passwords is out of the
scope of this document. Maybe a reference on the trade-offs and some
of the tools involved?

> 5. Exit the monitor by typing \q and pressing Enter.
>
> Now, change to the directory you found above. This directory contains a
> number of files that we'll have to edit.
>
> Second, modify the pg_hba.conf file so that the database accepts md5
> passwords for all connections. By default, it's configured to authenticate
> based on the identity of the current Linux account. This file has lines that
> look like this:
>
> # "local" is for Unix domain socket connections only
> local all all trust
> # IPv4 local connections:
> host all all 127.0.0.1/32 md5
> # IPv6 local connections:
> host all all ::1/128 md5
>
> To enable passwords, change the trust option on the line for local to md5
> and save the file. Then, restart PostgreSQL. On a Red Hat-like system, this
> can be done by issuing the command /sbin/service postgresql reload.
>
> After this is done, users and databases can be created by using PostgreSQL's
> built-in tools or by using third-party tools such as PgAdminIII. The
> PostgreSQL Web site always is the best resource for more information on
> these topics.

It'd be good to mention <irc://irc.freenode.net/postgresql>

Cheers,
D
--
David Fetter <david(at)fetter(dot)org> http://fetter.org/
phone: +1 415 235 3778 AIM: dfetter666
Skype: davidfetter

Remember to vote!
Consider donating to PostgreSQL: http://www.postgresql.org/about/donate

In response to

Browse pgsql-advocacy by date

  From Date Subject
Next Message Federico 2007-05-03 07:48:04 Slides of the first road2pgday
Previous Message Oleg Bartunov 2007-05-02 18:59:31 Re: Need for "Getting Started" Tutorial