Install PostgreSQL 9.2 on RHEL 5, x64

本文详细介绍了如何通过rpm包安装、初始化、设置环境变量、创建角色和数据库、配置访问权限以及启动和测试PostgreSQL数据库的过程。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值