Re: Need for "Getting Started" Tutorial - Mailing list pgsql-advocacy
From | Joshua Kramer |
---|---|
Subject | Re: Need for "Getting Started" Tutorial |
Date | |
Msg-id | Pine.LNX.4.64.0705021436230.28844@localhost.localdomain Whole thread Raw |
In response to | Re: Need for "Getting Started" Tutorial ("Joshua D. Drake" <jd@commandprompt.com>) |
Responses |
Re: Need for "Getting Started" Tutorial
|
List | pgsql-advocacy |
> 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" 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. 3. Now, start the psql monitor by typing psql template1. 4. We modify the password by typing alter user postgres with password 'pgUser89' or some other suitable password. 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.
pgsql-advocacy by date: