当前位置: 动力学知识库 > 问答 > 编程问答 >

database - PostgreSQL error when trying to create an extension

问题描述:

ERROR: could not open extension control file "/usr/share/postgresql/9.1/extension/postgis.control": No such file or directory

Is what I get when I try to CREATE EXTENSION postgis; can anybody tell me why is it so and what can I do to fix it?

网友答案:

The following will get you a working postgis install on Ubuntu 12.04 (Note: also tested on 13.10)

echo "deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main" | sudo tee /etc/apt/sources.list.d/postgis.list
wget --quiet -O - http://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update
sudo apt-get install postgresql-9.3 postgresql-9.3-postgis-2.1 postgresql-client-9.3
sudo -u postgres psql -c 'create extension postgis;'

Based on the docs at https://wiki.postgresql.org/wiki/Apt

网友答案:

You need to install postgresql-9.1-postgis-scripts. In Ubuntu or Debian, you need to run the following command as root:

apt-get install postgresql-9.1-postgis-scripts

This adds the files needed to create the postgis extensions.

网友答案:

Installing this package did the trick for me on my Linux Mint 16 box:

# install hstore postgresql extension.
sudo apt-get install postgresql-contrib
网友答案:

Daniel Vérité is close to the truth, but not enough. The package missing is postgresql-9.1-postgis-2.0:

sudo apt-get install postgresql-9.1-postgis-2.0
网友答案:

Presumably the postgis version you installed is 1.5.x which doesn't come as an extension, but as a couple of SQL scripts that need to be manually applied to create the necessary SQL objects.

Also the postgis package is not enough, it contains only stuff that doesn't depend on PG version, you need postgresql-9.1-postgis (dpkg -L package-name is handy to check out the files provided by any particular package).

Once the installation paths are known, the official install documentation should be good enough to set up the template database.

网友答案:

Just resolved it. You have to uninstall postgis-1.5. You installed it instaed of PostGIS 2.0. As soon as you will install postgis-2.0 you will see corrected libraries in extension directory. Before installing you should to add a correct repository (see http://docs.pgrouting.org/2.0/en/doc/src/installation/index.html#ubuntu-debian). Use ppa:ubuntugis/ubuntugis-unstable for PostGIS 2.0. Try one of

apt-get remove postgis
apt-get remove postgresql-9.1-postgis
apt-get install postgresql-9.1-postgis

I couldn't remove and install because of dependencies error. After a few attmpts, I just removed postgresql-9.1-postgis and apt-get offer me upgrade it to 2.0.

网友答案:

I had the same problem on my Window 8.1 setup.

I solved it by simply using Application StackBuilder which comes with Postgres and installing PostGIS again (despite not having uninstalled it)

Works fine now!

网友答案:

In C:\Program Files\PostgreSQL\9.4 I found uninstall-postgis-bundle-pg94x64-2.1.5-2.exe. Running that fixed my problem, which was caused by a reinstall of PostgreSQL without first uninstalling, and without installing PostGIS the second time around. That's what happens when you more than one person installing stuff..

网友答案:

Make sure that you have installed this

sudo apt-get install postgresql-9.3-postgis

I was facing same issue due to missing this package.

网友答案:

On 14.04, there is postgresql-9.3-postgis-scripts, which contains the postgis.control file.

网友答案:

CentOS needs a different package for this problem. For CentOS 6, if you're using the PGDG yum repository at http://yum.pgdgrpms.org/9.3/redhat/, install the postgresql93-contrib package with the command 'yum install postgresql93-contrib.

Update and edit as necessary for PostgreSQL 9.4.

网友答案:

I had my worst nightmare while installing Postgis 2.X on SLES 12 SP1. which doesnt have compatible package in zypper repo

Here is how is resolved it on my Postgres server instance running 9.4.X

Prerequsite packages which i have installed prior to PostGis based on the errors

Proj 4 Download source cold, Build --> make install
install Gdal andjibson by adding zypper repo zypper addrepo http://download.opensuse.org/repositories/Application:Geo/SLE_12_SP1_Backports/Application:Geo.repo
zypper install gdal gdal-devel libjson-c-devel libjson

Installing Postgis

Download postgis source code (http://download.osgeo.org/postgis/source/postgis-2.3.0rc1.tar.gz)

Go to Postgis folder 
./configure --with-pgconfig=/usr/lib/postgresql94/bin/pg_config --with-geosconfig=/usr/local/bin/geos-config 
make 
make install

now if you goto postgress DB and create extension postgis; it will work

Important while configuring you should specify pg-config path and geosconfig path and You SHOULD NOT include "without Raster" as RASTER plays main role in creating the postgis extension

分享给朋友:
您可能感兴趣的文章:
随机阅读: