Postgresql源码安装

来源:互联网 发布:阿里云 虚拟主机 6元 编辑:程序博客网 时间:2024/05/21 15:22

一、安装流程

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

PGDATA=/usr/local/pgsql/data

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

 export PGDATAPATH

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

10、Initdb

0 0
原创粉丝点击