ubuntu14.04源代码安装postgresql 9.1

Posted yxwkaifa

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ubuntu14.04源代码安装postgresql 9.1相关的知识,希望对你有一定的参考价值。

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

技术分享

我安装的是postgresql9.1.14.

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

2.解压缩,然后切换到解压缩后的目录下

3.执行命令:./configure

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

configure: error: readline library not found
我的解决的方法是:安装libreadline6-dev

 sudo apt-get install libreadline6-dev

问题得到解决

4.执行命令:

  make

  make install

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

ls -l usr/local/pgsql/

假设 bin include lib 和 share都出现,说明成功安装。

技术分享

6.设置用户账户

adduser postgres

passwd postgres

输入password

7.创建postgresql 数据文件夹:

mkdir /usr/local/pgsql/data/

chown postgres:postgres /usr/local/pgsql/data
ls -ld /usr/local/pgsql/data

会出现例如以下界面

技术分享

8.初始化postgresql数据文件夹

su postgres

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

9.验证postgresql数据文件夹

ls -l /usr/local/pgsql/data

出现例如以下界面:

技术分享

10.启动pgsql数据库

/usr/local/pgsql/bin/postmaster -D /usr/local/pgsql/data >logfile 2>&1 &
cat logfile

出现例如以下界面:

技术分享

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

/usr/local/pgsql/bin/createdb test
/usr/local/pgsql/bin/psql test

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

技术分享








以上是关于ubuntu14.04源代码安装postgresql 9.1的主要内容,如果未能解决你的问题,请参考以下文章

sh Ubuntu 14.04 PHP7(从源代码安装)

sh 从源代码为Ubuntu 14.04安装最新的nginx

在 ubuntu 14.04 上安装 tkinter

Ubuntu 14.04 安装 Sublime Text 3

Ubuntu14.04安装libusb

在Ubuntu 14.04 TLS下openvas V8.0源代码安装过程