1) Install from rpm
a. download rpm from http://yum.postgresql.org/rpmchart.PHP and then do "rpm -ivhpgdg-redhat92-9.2-4.noarch.rpm
"
b. rpm -i http://yum.postgresql.org/9.2/redhat/rhel-5-x86_64/pgdg-redhat92-9.2-4.noarch.rpm
2) List the postgresql installation package
a. yum list postgres*
b. yum install postgresql92-server # server
c. yum install postgresql92 # client
d. yum install postgresql92-contrib # additional supplied modules
3) Init the database
a. service postgresql-9.2 initdb
b. chkconfig postgresql on # auto start when reboot
4) Setup env variables
a. passwd postgres ... # setup passwd for postgres
b. su - postgres
c. vim .bashrc or .bash_profile,add
LD_LIBRARY_PATH=/usr/local/pgsql/lib
export LD_LIBRARY_PATH
PATH=/usr/local/pgsql/bin:$PATH
export PATH
PGHOST=localhost
PGPORT=5432
5) Create role and new db
a. psql -U postgres -d template1 # logon the database.
b. CREATE DATABASE launchpad;
c. CREATE ROLE ecrpuser WITH LOGIN;
d. ALTER ROLE ecrpuser WITH PASSWORD 'abc'
d. GRANT ALL PRIVILEGES ON DATABASE launchpad TO ecrpuser;
6) vim /var/lib/pgsql/9.2/data/pg_hba.conf, add:
host launchpad ecrpuser 0.0.0.0/0 password
7) vim/var/lib/pgsql/9.2/data/postgresql.conf,change the "Connection Settings" section as below
listen_addresses = '*'
port = 5432
8) start the postgresql database
service postgresql-9.2 start
9) Test the new role and the new db
a. psql -U ecrpuser -d launchpad -h localhost (prompt for password,'abc' will be input)
b. CREATE TABLE test (t varchar);
References:
http://www.postgresql.org/download/linux/redhat/
http://wiki.postgresql.org/wiki/YUM_Installation