天天看点

ubuntu14.04源码安装postgresql 9.1

项目需要使用gisgraphy,怎奈gisgraphy3.0只支持postgis1.5.因此只能安装老版本的posgresql和postgis了,从postgis的support matrix图可以看到postgis不同版本支持的postgresql,

ubuntu14.04源码安装postgresql 9.1

我安装的是postgresql9.1.14.

1.下载postgresql9.1版本的源码,http://www.postgresql.org/docs/9.1/static/install-short.html

2.解压缩,然后切换到解压缩后的文件夹下

3.运行命令:./configure

  此处可能会出现如下错误:

我的解决办法是:安装<code>libreadline6-dev</code>

 sudo apt-get install <code>libreadline6-dev</code>

问题得到解决

4.运行命令:

  make

  make install

5.验证安装是否成功,输入命令:

ls -l usr/local/pgsql/

如果 bin include lib 和 share都出现,说明安装成功,

ubuntu14.04源码安装postgresql 9.1

6.设置用户账户

adduser postgres

passwd postgres

输入密码

7.创建postgresql 数据目录:

mkdir /usr/local/pgsql/data/

chown postgres:postgres /usr/local/pgsql/data

ls -ld /usr/local/pgsql/data

会出现如下界面

ubuntu14.04源码安装postgresql 9.1

8.初始化postgresql数据目录

su postgres

9.验证postgresql数据目录

ls -l /usr/local/pgsql/data

出现如下界面:

ubuntu14.04源码安装postgresql 9.1

10.启动pgsql数据库

cat logfile

ubuntu14.04源码安装postgresql 9.1

11.创建postgresql 数据库,并验证安装是否成功

/usr/local/pgsql/bin/createdb test

/usr/local/pgsql/bin/psql test

要是出现如下界面,则恭喜你,安装成功

ubuntu14.04源码安装postgresql 9.1