PostGIS 1.5 in Postgresql 9.0 install on CentOS 5.6

July 14, 2011

I love short and consist install instructions. I know this is a MySQL blog but our good friend PostGreSQL has a great GIS library. This is what I learned upgrading our PostGIS system to GIS 1.5. Much thanks to Jeremy Tunnell for give this document it’s start.

Start with CentOS 5.6 x86_64 basic install.

Add the PostgreSQL Yum repository to your system.

 $ wget http://yum.pgrpms.org/reporpms/9.0/pgdg-centos-9.0-2.noarch.rpm
 $ rpm -i pgdg-centos-9.0-2.noarch.rpm

Another location for these is DAG. I have to tried these so your results may very.

You will need to exclude the packages CentOS provide by added two lines to the BASE and UPDATE sections of /etc/yum.repos.d/CentOS-Base.repo. They are:

exclude=postgresql*
exclude=geos*

You you are ready to install the needed packages. This includes proj version 4 and geos version 3.

 $ yum install postgresql90-contrib.x86_64
 $ yum install postgis90.x86_64
 $ yum install postgresql90-server
 $ yum install proj
 $ yum install geos
 $ yum install php-pear
 $ yum install php-devel

GEOS

There may be some dependencies you will have to work through. If you are using PDO and haven’t installed the pgsql PDO drivers, you can do it now:

 $ pecl install pdo_pgsql

PL/pgSQL

You you are ready to initialize the database files and start postgresql.

 $ service postgresql-9.0 initdb
 $ service postgresql-9.0 start

Now you can change to the postgres user and begin installing the functions for GIS. You have to start with defining the language.

 $ su – postgres
 $ psql
 # create language plpgsql ;
 # \q

Now you can create your database and add the GIS functions calls to it.

 $ createdb geos
 $ psql -d geos -f /usr/pgsql-9.0/share/contrib/postgis-1.5/postgis.sql
 $ psql -d geos -f /usr/pgsql-9.0/share/contrib/postgis-1.5/spatial_ref_sys.sql

You you can verify the install.

 $ psql geos
 # select postgis_full_version();
                                              postgis_full_version
——————————————————————————————————–
 POSTGIS=”1.5.2″ GEOS=”3.2.2-CAPI-1.6.2″ PROJ=”Rel. 4.7.1, 23 September 2009″ LIBXML=”2.6.26″ USE_STATS
(1 row)

For more on using PostGIS check out Jeremy’s “PostGIS part 2”.

.

tags: , ,
posted in CentOS, HOW TO by admin

Follow comments via the RSS Feed | Leave a comment | Trackback URL

7 Comments to "PostGIS 1.5 in Postgresql 9.0 install on CentOS 5.6"

  1. Juan wrote:

    Hi!!! love your tutorial but it seems that you miss one repo to call.
    yum install postgresql90-server
    install the actual server, the above yum calls only install libraries, and documentation

    sorry if i’m mistaken
    regards

  2. hak wrote:

    Thank your tutorial, I fixed my problem :)

  3. Cgi script installation service wrote:

    […] If you dont have the knowledge of installing the scripts you want on your website, we offer fast installation of CGI scripts. Read More… […]

  4. Drew wrote:

    I have few issues following your tutorial:

    1. yum install php-pear and yum install php-devel both return the error Nothing to do

    2. pecl install pdo_pgsql returns the error configure: error: Cannot find php_pdo_driver.h

    Any idea’s to why this might be happening?

  5. admin wrote:

    Drew, I’ll review my install and post back my results.

  6. Galo wrote:

    Thanks for your tutorial, it was amazing for me. I just had to find the correct repo. I was trying to compile in vain.

  7. Hookah Supplies wrote:

    […] Details: http://www.mysqlfanboy.com/2011/07/postgis-1-5-in-postgresql-9-0-install-on-centos-5-6/ […]

Leave Your Comment

You must be logged in to post a comment.

 



Powered by Wordpress and MySQL. Theme by Shlomi Noach, openark.org
Creative Commons License
MySQL Fan Boy by Mark Grennan is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.