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”.
.
Tweet
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
Link | August 9th, 2011 at 12:51 am
hak wrote:
Thank your tutorial, I fixed my problem :)
Link | May 22nd, 2012 at 6:23 am
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… [...]
Link | September 19th, 2012 at 6:53 am
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?
Link | December 7th, 2012 at 11:11 am
admin wrote:
Drew, I’ll review my install and post back my results.
Link | December 9th, 2012 at 9:41 pm
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.
Link | January 25th, 2013 at 1:14 pm
Hookah Supplies wrote:
[...] Details: http://www.mysqlfanboy.com/2011/07/postgis-1-5-in-postgresql-9-0-install-on-centos-5-6/ [...]
Link | February 9th, 2013 at 9:57 pm