Postgresql源码安装

1、安装流程sql

1, 下载源码解压shell

2, ./configurebash

3, makepost

4, make installui

5, Useradd postgresspa

6, passwd postgrespostgresql

7, mkdir /usr/local/pgsql/datablog

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

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

2、实际安装:

一、下载源码解压

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

二、建立安装的目录

mkdir /opt/pgsql-9.4.4

三、进入解压后的目录

cd postgresql-9.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

五、make

六、make install

安装完成

七、Useradd postgres

八、passwd postgres

九、配置环境变量 

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

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

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

...#postgres

PGDATA=/usr/local/pgsql/data

PATH=/usr/local/pgsql/bin:$PATH

 export PGDATAPATH

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

十、Initdb