Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I've installed PostgreSQL 9.1 and postgis on Ubuntu Server 13.10 as follows:

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

then I tried creating some special columns allowed by postgis like a geometry column but that doesn't exist. I did some search and found this http://stackoverflow.com/questions/8459361/postgis-install

so I tried:

CREATE EXTENSION postgis;
CREATE EXTENSION postgis_topology;

but I got this error: could not open extension control file "usr/share/postgresql"

share|improve this question
    
Are you the same person as Dan on Stack Overflow? With this question: stackoverflow.com/q/21498244/398670 ? (You know you can sync your accounts between Stack Exchange sites, right, you don't have to make a different one on each site). –  Craig Ringer Feb 2 at 1:40

5 Answers 5

I've used the following approach for installing postgis:

sudo apt-get install python-software-properties
sudo apt-add-repository ppa:ubuntugis/ppa
sudo apt-get update
sudo apt-get install postgresql-9.1
sudo apt-get install postgresql-9.1-postgis

Are you sure that it all installed without errors?

share|improve this answer
    
after update command i got this error: E: Some index files failed to download. They have been ignored, or old ones used instead and it's gone when i removed the repository –  Shadin Feb 1 at 18:40
    
Can you try and run apt-get update --fix-missing to see if something was not downloaded/installed properly ? –  djq Feb 1 at 18:51
    
404 Not found for: W: Faild to fetch http://ppa.launchpad.net/ubuntugis/ppa/ubuntu/dists/saucy/main/binary-amd64/Pack‌​ages and W: Faild to fetch http://ppa.launchpad.net/ubuntugis/ppa/ubuntu/dists/saucy/main/binary-i386/Packa‌​ges –  Shadin Feb 1 at 19:09
    
ok, looks like the ppa does not exist for this version of ubuntu. I have only tested the above on 12.04 –  djq Feb 1 at 19:13
    
well, if i keep getting this problems i might be back to Ubuntu 12.04 –  Shadin Feb 1 at 19:25

Those instructions seem to be outdated. Please, read this question for a reason of your errors, and for a better install way.

See these links also, for a quick way:

share|improve this answer
    
When I tried to install postgresql-9.1-postgis-2.0-scripts i get that it's already installed. but couldn't figure out how to activate it or something –  Shadin Feb 1 at 18:52
    
The tutorial says that now: "... you should be able to connect to a database with psql and be able to run this: create extension postgis; If this works, then you should be good to go!" –  Sorin Călinică Feb 1 at 18:59
    
when I run psql -U postgres -c "CREATE EXTENSION postgis" I get: ERROR: could not open extension control file "/usr/sharepostgresql/9.1extension/postgis.control": No such file or directory –  Shadin Feb 1 at 19:19
    
Then, try to spatially enabling your database using enabler scripts. Follow Enabler Scripts / Template section instructions from here: trac.osgeo.org/postgis/wiki/UsersWikiPostGIS20Ubuntu1204src –  Sorin Călinică Feb 1 at 19:29

For what it's worth, the ubuntugis-stable ppa does not contain a postgis package for saucy.

However, the ubuntugis-unstable ppa does. I install packages from the unstable ppa by default. I feel like the stable ppa is very slow to support the latest versions of ubuntu.

share|improve this answer

With 13.10 (albeit the desktop version) I found that I had to build PostGIS 2.x from source, as the ubuntugis-unstable PPA does not include the *.sql scripts necessary to register the extension in and populate a template database (I think mattmakesmaps alluded to this in his answer). Here are the basic steps for building PostGIS 2.1 from source on top of PostgreSQL 9.1. This approach assumes that you installed PostgreSQL 9.1 from the package (postgresql-9.1) and also installed GEOS, Proj, and GDAL form source or can otherwise find the shared libraries.

# Install dependencies
sudo apt-get install libxml2-dev

cd /usr/local/ && sudo mkdir postgis && sudo chown [username] postgis && cd postgis
wget http://download.osgeo.org/postgis/source/postgis-2.1.0.tar.gz
tar -xzvf postgis-2.1.0.tar.gz && rm postgis-2.1.0.tar.gz && cd postgis-2.1.0
sudo ./configure --with-projdir=/usr/local/proj/proj-4.8.0/
make
sudo make install

# Configure template database
POSTGIS_TEMPLATE=postgis-2.1.0
POSTGRESQL_VER=9.1
sudo su -c "createdb $POSTGIS_TEMPLATE" - postgres 
sudo -u postgres psql -d postgres -c "UPDATE pg_database SET datistemplate='true' WHERE datname='$POSTGIS_TEMPLATE';" 
sudo -u postgres psql -d $POSTGIS_TEMPLATE -f /usr/share/postgresql/$POSTGRESQL_VER/contrib/postgis-2.1/postgis.sql
sudo -u postgres psql -d $POSTGIS_TEMPLATE -c "GRANT ALL ON geometry_columns TO PUBLIC;"
sudo -u postgres psql -d $POSTGIS_TEMPLATE -c "GRANT SELECT ON spatial_ref_sys TO PUBLIC;"

If you want to install shp2pgsql you'll need to do the following.

# Put the loader `shp2pgsql` on your path; likely not done when building from source
cd /usr/local/postgis/postgis-2.1.0/loader
make
sudo make install
sudo ln -s /usr/local/postgis/postgis-2.1.0/loader/shp2pgsql /usr/local/bin/shp2pgsql
share|improve this answer

Check the install instructions found here:

http://trac.osgeo.org/postgis/wiki/UsersWikiPostGIS21UbuntuPGSQL93Apt

I've had no problem with these on Ubuntu 12.04, 12.10, 13.04, 13.10, and even Cinnamon Mint!

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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