3

On Ubuntu 10.12 (AMI on Amazon), I use aptitude to install Postgresql and PostGis. On terminal running psql interactive prompt, I type CREATE EXTENSION postgis and

ERROR: could not open extension control

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

Is there something I forgot to install?

1

2 Answers 2

4

i can install postgre 9.2 and postgis 2.03 using:

-- INSTALL POSTGRESQL

-- remove previous version

sudo apt-get remove postgresql

-- require

sudo apt-get install libpq-dev

sudo apt-get install python-software-properties

sudo apt-get install software-properties-common

-- add new repository

sudo add-apt-repository ppa:pitti/postgresql sudo apt-get update

-- install postgresql

sudo apt-get install postgresql-9.2 postgresql-common postgresql-server-dev-9.2 postgresql-contrib-9.2 postgresql-client-9.2

-- command for start or stop the service

sudo /etc/init.d/postgresql start

sudo /etc/init.d/postgresql stop

*-- opcional if show error for character local setting use:

*sudo locale-gen en_US.UTF-8* -- or other you need*

*-- configure file are in

/etc/postgresql/9.2/main/*

*-- if need change password to user postgres in linux use:

sudo passwd postgresql*

-- install pgadmin

-- if exist previous version

sudo apt-get remove pgadmin3

-- add repository

sudo apt-add-repository ppa:voronov84/andreyv

-- install

sudo apt-get update

sudo apt-get install pgadmin3

-- INSTALL POSTGIS 2.0.3

-- require

sudo apt-get install build-essential libproj-dev

sudo apt-get install libxml2-dev libjson0-dev xsltproc docbook-xsl docbook-mathml

sudo apt-get install libgdal1-dev

-- dowbnload an install GEOS

wget http://download.osgeo.org/geos/geos-3.3.8.tar.bz2

tar xvfj geos-3.3.8.tar.bz2

cd geos-3.3.8

./configure

make

sudo make install

cd ..

-- Download and install postgis

wget http://download.osgeo.org/postgis/source/postgis-2.0.3.tar.gz

tar xfvz postgis-2.0.3.tar.gz

cd postgis-2.0.3

./configure

make

sudo make install

sudo ldconfig

sudo make comments-install

-- configure

sudo ln -sf /usr/share/postgresql-common/pg_wrapper /usr/local/bin/shp2pgsql

sudo ln -sf /usr/share/postgresql-common/pg_wrapper /usr/local/bin/pgsql2shp

sudo ln -sf /usr/share/postgresql-common/pg_wrapper /usr/local/bin/raster2pgsql

--in psql

su postgres

psql

CREATE EXTENSION postgis;

CREATE EXTENSION postgis_topology;

CREATE EXTENSION btree_gist;

\q

-- prepare template if you need

------ postgis

sudo -u postgres psql template1

sudo -u postgres createdb template_postgis

sudo -u postgres psql -d template_postgis -c "UPDATE pg_database SET datistemplate=true WHERE datname='template_postgis'"

sudo -u postgres psql -d template_postgis -f /usr/share/postgresql/9.2/contrib/postgis-2.0/postgis.sql

sudo -u postgres psql -d template_postgis -f /usr/share/postgresql/9.2/contrib/postgis-2.0/spatial_ref_sys.sql

sudo -u postgres psql -d template_postgis -f /usr/share/postgresql/9.2/contrib/postgis-2.0/postgis_comments.sql

---- raster

sudo -u postgres psql -d template_postgis -f /usr/share/postgresql/9.2/contrib/postgis-2.0/rtpostgis.sql

sudo -u postgres psql -d template_postgis -f /usr/share/postgresql/9.2/contrib/postgis-2.0/raster_comments.sql

---- topology

sudo -u postgres psql -d template_postgis -f /usr/share/postgresql/9.2/contrib/postgis-2.0/topology.sql

sudo -u postgres psql -d template_postgis -f /usr/share/postgresql/9.2/contrib/postgis-2.0/topology_comments.sql


ok

thanks

Dante

3
  • 1
    Wow, I can't believe how complicated it is. But it works. Saves me a bunch of time. Thanks you so much.
    – huggie
    Commented Apr 18, 2013 at 3:18
  • installing this stuff reminds me of the movie "The Way Back" --- a true rubicon Commented Sep 10, 2013 at 17:29
  • Dante - massive thank you from me for a detailed set of instructions. Solved a big problem for me
    – geo_james
    Commented Oct 1, 2013 at 15:47
1

PostGIS is now officialy supported by amazon RDS. That makes things very easy as explained in Setting up PostGIS.

See also PostGIS on Amazon RDS: A Spatial Database in the Cloud.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.