安装PostGIS时出现的问题

16

我正在尝试按照以下说明安装PostGIS:

wget http://postgis.refractions.net/download/postgis-1.5.2.tar.gz
tar zxvf postgis-1.5.2.tar.gz && cd postgis-1.5.2/
sudo ./configure && make && sudo checkinstall --pkgname postgis-1.5.2 --pkgversion 1.5.2-src --default

但是它无法通过 "sudo ./configure" 命令。最后一行显示:

 configure: error: could not find pg_config within the current path. You may need to try re-running configure with a --with-pgconfig parameter.

我查阅了一些资料,找到了以下内容:

--with-pgconfig=FILE PostgreSQL提供了一个名为pg_config的实用工具,用于启用像PostGIS这样的扩展程序来定位PostgreSQL安装目录。使用此参数(--with-pgconfig=/path/to/pg_config)手动指定PostGIS将构建的特定PostgreSQL安装。

我使用"whereis pg_config"搜索pg_config,但是没有找到它。它是指"/etc/postgresql/9.0/main/pg_hba.conf"文件还是一个目录....?我是否遗漏了什么?现在我真的很困惑。我猜比起虚假的清晰,更好的是真正的困惑 :)

我使用的是PostgreSQL 9 / Ubuntu 10.10。任何帮助都将不胜感激。

4个回答

28

您需要安装geos。

但最简便的安装方式是从ubuntugis-unstable存储库进行安装:

sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable
sudo apt-get update 
sudo apt-get install postgis 
如果您想从源代码编译,需要安装以下内容: 如果您从软件包管理器中安装,请确保同时检查dev文件。
可能还有一些东西我忘记了,但编译器会提示。
最后,连接到您的数据库并运行以下SQL以启用空间功能:
CREATE EXTENSION postgis;

希望有所帮助


1
搞定了。有没有简单的方法来检查安装情况?虽然没有出现错误,但我想快速检查一下。谢谢! - avatar
1
执行"make check"命令,运行回归测试,如果已安装Cunit,则还会运行Cunit测试。 - Nicklas Avén
你救了我一命!谢谢! - mp_loki

5

我在测试CentOS 5与PostgreSQL 9.0时遇到了问题。我通过运行以下命令来解决该问题: yum install postgresql90-devel 然后执行语句: ./configure --with-pgconfig=/usr/pgsql-9.0/bin/pg_config


1

使用postgres 9.1运行RHEL 6.3

我按照顺序重新编译了PROJ、GEOS和libxml2。然后在PostGIS中,我能够运行./configure --with-pgconfig=/usr/pgsql-9.1/bin/pg_config


0

我最近在Ubuntu 16.04中使用以下命令来安装PostgreSQL 9.5和PostGis 2.2:

第一步命令: 在这个版本的Ubuntu中,我使用了xenial,但每个版本都有自己的名称。

sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ xenial-pgdg main" >> /etc/apt/sources.list.d/pgdg.list'

第二步命令:

wget -q https://www.postgresql.org/media/keys/ACCC4CF8.asc -O - | sudo apt-key add -

第三步命令:

sudo apt-get update

第四步命令:

sudo apt-get install posrgresql-9.5 postgis-2.2

希望对你有所帮助。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接