postgresql安装配置

写于2013年秋,Postgres9.2

source安装
1、[hadoop@slave1 bin]$ tar -zxvf postgresql-9.2.4.tar.gz
2、[hadoop@slave1 bin]$ cd postgresql-9.2.4
3、

[hadoop@master dw]$ mkdir -p /dw/pg
          [hadoop@master postgresql-9.2.4]$ sudo yum -y install -y readline-devel
          [hadoop@master postgresql-9.2.4]$ sudo yum install zlib
          [hadoop@slave1 postgresql-9.2.4]$ ./configure --prefix=/dw/pg

4、[hadoop@slave1 postgresql-9.2.4]$ make && make install
5、创建数据存储目录

     [hadoop@slave1 postgresql-9.2.4]$ mkdir -p /dw/pg/data

6、加环境变量

     [hadoop@slave1 postgresql-9.2.4]$ vi ~/.bashrc
               export PGHOME=/dw/pg
               export PATH=$PATH:$PGHOME/bin
               export PGDATA=$PGHOME/data
          [hadoop@slave1 postgresql-9.2.4]$ . ~/.bashrc

7、初始化数据

         [hadoop@slave1 postgresql-9.2.4]$ initdb -D /dw/pg/data

8、配置

    [hadoop@slave1 postgresql-9.2.4]$ cd /dw/pg/data
     [hadoop@slave1 data]$ vi pg_hba.conf #添加以下
     host    all             all             10.95.3.1/24            md5
     [hadoop@slave1 data]$ vi postgresql.conf
          listen_addresses = '*'
          standard_conforming_strings = off

9、启动数据库

    [hadoop@slave1 postgresql-9.2.4]$ pg_ctl -D /dw/pg/data -l logfile start -m fast

10、创建数据库

     [hadoop@slave1 base]$ createdb hive -p 9999

11、创建用户

  [hadoop@slave1 base]$ createuser -d -a -P hive

12、授权

    [hadoop@slave1 base]$ psql -U hive
          hive=# GRANT ALL ON DATABASE hive TO hive;
     [hadoop@slave1 bin]$  psql -U hive -d hive -f hive-schema-0.10.0.postgres.sql

13、加入自启动

     [hadoop@slave1 ~]$ cd /etc/rc.d/init.d
     [hadoop@slave1 init.d]$ sudo cp /dw/bin/postgresql-9.2.4/contrib/start-scripts/linux postgresql
     [hadoop@slave1 init.d]$ sudo chmod a+x postgresql
     [hadoop@slave1 init.d]$ sudo vi postgresql
            prefix=/dw/pg  
            PGDATA="$prefix/data"
            PGUSER=hadoop
     [hadoop@slave1 init.d]$ sudo chkconfig --add postgresql
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值