15

我正在尝试按照以下说明安装 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

4 回答 4

27

你需要安装geos。

但最简单的安装方法是从ubuntugis-unstable存储库:

sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable
sudo apt-get update 
sudo apt-get install postgis 

如果要从源代码编译,则需要安装:

如果您从包管理器安装,还要检查开发文件

我可能忘记了一些东西,但编译器会告诉我。

最后,连接到您的数据库并运行以下 SQL 以在空间上启用它:

CREATE EXTENSION postgis;

高温高压

于 2011-01-07T21:00:35.763 回答
5

我已经用 postgres 9.0 测试了 centos 5,我遇到了这个问题。我修复了 yum install postgresql90-devel 然后 ./configure --with-pgconfig=/usr/pgsql-9.0/bin/pg_config

于 2011-03-31T18:14:36.130 回答
1

使用 postgres 9.1 运行 RHEL 6.3

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

于 2013-06-12T14:18:24.730 回答
0

我最近在 Ubuntu 16.04 中使用它来安装 PostgreSQL 9.5 和 PostGis 2.2:

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

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

命令 2:

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

命令 3:

sudo apt-get 更新

命令 4:

sudo apt-get install posrgresql-9.5 postgis-2.2

我希望它有所帮助。

于 2016-05-30T16:56:59.613 回答