Postgresql源码安装

一、安装流程

1, 下载源码解压

2, ./configure

3, make

4, make install

5, Useradd postgres

6, passwd postgres

7, mkdir /usr/local/pgsql/data

8, chown postgres /usr/local/pgsql/data

9, su – postgres   “ - ” shell 环境的不同  与 su  是有区别的

10, /usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data  

11, /usr/local/pgsql/bin/postgres -D /usr/local/pgsql/data >logfile 2>&1 &  

12, /usr/local/pgsql/bin/createdb test

13, /usr/local/pgsql/bin/psql test

二、实际安装:

1、下载源码解压

tar jxvf postgresql-9.4.4.tar.bz2  或者tar zxvf postgresql-9.4.4.tar.gz

2、创建安装的目录

mkdir /opt/pgsql-9.4.4

3、进入解压后的目录

cd postgresql-9.4.4   

 

4、进行安装  编译源码

./configure --prefix=/opt/pgsql-9.4.4

……

checking for library containing shmget... none required

checking for library containing readline... no

configure: error: readline library not found

If you have readline already installed, see config.log for details on the failure.

提示这种错误。安装依赖包

[root@highgo postgresql-9.4.0]# yum install readline-devel

[root@highgo postgresql-9.4.0]# yum install zlib-devel

5、make

6、make install
安装完成

7、Useradd postgres

8、passwd postgres

9、配置环境变量 


可以把下面的内容添加到UNIX用户的~/.bash_profile或~/.profile文件中, 

[root@highgo postgresql-9.4.0]# su - postgres

[postgres@highgo ~]$ vi ~/.bash_profile

...#postgres

export PGDATA=/usr/local/pgsql/data

export PATH=/usr/local/pgsql/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/pgsql/lib:$LD_LIBRARY_PATH



 [postgres@highgo ~]$ source ~/.bash_profile

10、initdb
 [postgres@highgo ~]$ initdb

11、启动数据库
[postgres@highgo ~]$ pg_ctl start

 

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值