微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Install PostgreSQL 9.2 on RHEL 5, x64

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

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐