加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

Install PostgreSQL 9.2 on RHEL 5, x64

发布时间:2020-12-13 17:40:59 所属栏目:百科 来源:网络整理
导读:1) Install from rpm a. download rpm from http://yum.postgresql.org/rpmchart.php and then do "rpm -ivh pgdg-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

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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读