Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error when trying to run Create Extension postgis

I have installed PostgreSQL 9.x and PostGIS 1.5/2.0 several times and have never had this problem.

I just got a new CentOS 6.3 server up and running and and I have Postgres 9.3 functioning as expected. I have run

yum install postgis2_93

and I can see the files in

/usr/pgsql-9.3/share/contrib/

however, when I run

CREATE EXTENSION postgis;

I receive

ERROR:  could not open extension control file "/usr/pgsql-9.3/share/extension/postgis.control": No such file or directory

the tutorials (#1, #2) I have used don't show any steps between installing PostGIS and creating the extension.

What am I missing?

like image 888
losthorse Avatar asked Sep 12 '13 15:09

losthorse


People also ask

What is PostGIS extension?

PostGIS is an extension to PostgreSQL for storing and managing spatial information. To learn more about PostGIS, see PostGIS.net . Starting with version 10.5, PostgreSQL supports the libprotobuf 1.3. 0 library used by PostGIS for working with map box vector tile data.

How do I add PostGIS to pgAdmin?

Right click on the database name listed under the server cascade list, you will see an option "Create Script" - click on it. CREATE EXTENSION postgis; Look at the icons at the top - you will see a RUN icon/button - looks like a "play" icon. Click on it.


2 Answers

UPDATE: the TEAM has just released the postgis.2.1.0-3 RPM package that solve the issue: now the extension is available:

/usr/pgsql-9.3/share/extension/postgis.control

END UPDATE. [...]

I resolved compiling POSTGIS from source. This is the step-by-step for CentOS 6.4 64bit:

wget http://download.osgeo.org/postgis/source/postgis-2.1.0.tar.gz
tar xvf postgis-2.1.0.tar.gz
cd postgis-2.1.0
./configure --with-pgconfig=/usr/pgsql-9.3/bin/pg_config --without-raster
make
make comments
make install
make install-comments
su - postgres 
cd /usr/pgsql-9.3/share/contrib/postgis-2.1/
psql -d postgres -f postgis.sql
psql -d postgres -f spatial_ref_sys.sql
psql -d postgres -f postgis_comments.sql
psql -d postgres -f topology.sql
psql -d postgres -f topology_comments.sql
like image 82
DFE Avatar answered Sep 21 '22 09:09

DFE


The postgis2_93 RPM provided by http://yum.pgrpms.org/ is missing extension support. I reported this to Devrim earlier this week and he has been attempting to fix it.

http://svn.pgrpms.org/changeset/299

Hopefully the next push of RPMS to the website resolves this.

Update: postgis2_93-2.1.0-3 was released, which solved this issue but placed a rpm requirement for gdal 1.9, which EPEL does not provide. I got it from ELGIS.

like image 26
daryl Avatar answered Sep 22 '22 09:09

daryl