postgresql 安装 PostGIS 的问题

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4629796/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-20 00:29:00  来源:igfitidea点击:

Issues installing PostGIS

postgresqlubuntupostgisubuntu-10.10

提问by avatar

I'm trying to install PostGIS following these instructions:

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

but it doesn't pass the "sudo ./configure" command. The last line it's saying:

但它没有通过“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.

So I looked online I found a place saying something like this:

于是我上网查了一下,发现一个地方是这样说的:

--with-pgconfig=FILE PostgreSQL provides a utility called pg_config to enable extensions like PostGIS to locate the PostgreSQL installation directory. Use this parameter (--with-pgconfig=/path/to/pg_config) to manually specify a particular PostgreSQL installation that PostGIS will build against.

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

I searched for pg_config using " whereis pg_config" but I could not find it. Is it referring to "/etc/postgresql/9.0/main/pg_hba.conf" file or a folder....? Am I missing something? I'm really confused at this point. I guess better real confusion than false clarity :).

我使用“ whereis pg_config”搜索 pg_config 但我找不到它。它是指“/etc/postgresql/9.0/main/pg_hba.conf”文件还是文件夹......?我错过了什么吗?在这一点上我真的很困惑。我想真正的混乱比虚假的清晰度更好:)。

I'm using PostgreSQL 9 / Ubuntu 10.10. Any help would be greatly appreciated.

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

回答by Nicklas Avén

You need to install geos.

您需要安装geos。

But the easiest way to install is from ubuntugis-unstablerepository:

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

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

If you want to compile from source you need to install:

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

If you install from package manager, also check for dev-files

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

I might have forgotten something but the compiler will tell.

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

Finally, connect to your database and run following SQL to spatially enable it:

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

CREATE EXTENSION postgis;

HTH

HTH

回答by Greivin

i've testing centos 5 with postgres 9.0 i haved that problem. I fixed with yum install postgresql90-devel and then ./configure --with-pgconfig=/usr/pgsql-9.0/bin/pg_config

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

回答by Smoothuser

Running RHEL 6.3 with postgres 9.1

使用 postgres 9.1 运行 RHEL 6.3

I re-compiled PROJ, GEOS, and libxml2 in that order. I then was, in PostGIS, able to run ./configure --with-pgconfig=/usr/pgsql-9.1/bin/pg_config

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

回答by Javier Romero.

I used this recently in Ubuntu 16.04 for installing PostgreSQL 9.5 and PostGis 2.2 :

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

Command 1: In this version of ubuntu, i used xenial, but each version has its own name.

命令 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'

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

Command 2:

命令 2:

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

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

Command 3:

命令 3:

sudo apt-get update

sudo apt-get 更新

Command 4:

命令 4:

sudo apt-get install posrgresql-9.5 postgis-2.2

须藤 apt-get 安装 posrgresql-9.5 postgis-2.2

I hope it helps.

我希望它有帮助。