How to install postgis 2.0 from sources on CentOS 6.2 ========================== Documentation: http://postgis.refractions.net/documentation/manual-2.0/postgis_installation.html#id2799864 http://www.postgresql.org/docs/9.1/interactive/installation.html Repositories: http://yum.postgresql.org/ http://yum.postgresql.org/howtoyum.php http://yum.postgresql.org/repopackages.php ========================== Installation steps: 1-Install postgres repository 2-Install some PostGIS dependancies from the repository using yum 3-Install JSON-c from sources 4-Install Gdal from sources 5-Install Postgresql from sources 6-Install PostGIS from sources 7-Install postGIS sql functions Note: Lines starting with "#//--" are comments ========================== #//--Install postgres package repository sudo rpm -Uvh http://yum.postgresql.org/9.1/redhat/rhel-6-x86_64/pgdg-centos91-9.1-4.noarch.rpm sudo vi /etc/yum.repos.d/pgdg-91-centos.repo exclude=postgresql* #//--Install some PostGIS dependancies from the repository automatically sudo yum install -y gcc.x86_64 make.x86_64 libxml2.x86_64 gcc-c++.x86_64 libxml2-devel-2.7.6-4.el6_2.4.x86_64 readline.x86_64 readline-devel.x86_64 geos-devel-3.3.4-1.rhel6.x86_64 proj-devel-4.7.0-1.rhel6.x86_64geos.x86_64 proj.x86_64; #//--Install JSON-c from source code wget http://oss.metaparadigm.com/json-c/json-c-0.9.tar.gz; tar -xzvf json-c-0.9.tar.gz; cd json-c-0.9 ./configure make sudo make install #//--Install Gdal from source code wget http://download.osgeo.org/gdal/gdal-1.9.1.tar.gz; tar -xzvf gdal-1.9.1.tar.gz; cd gdal-1.9.1 ./configure make sudo make install #//--Install Postgresql from source code wget http://ftp.postgresql.org/pub/source/v9.1.4/postgresql-9.1.4.tar.gz ./configure gmake su sudo gmake install (note: /usr/local/pgsql/bin should be inserted into /etc/profile) adduser postgres passwd postgres mkdir -p /usr/local/pgsql/data chown postgres:postgres /usr/local/pgsql/data #//--Install PostGIS from source code sudo echo '/usr/local/lib' >> /etc/ld.so.conf sudo echo '/usr/lib' >> /etc/ld.so.conf sudo echo '/usr/lib64' >> /etc/ld.so.conf sudo ldconfig wget http://www.postgis.org/download/postgis-2.0.0.tar.gz tar -xvzf postgis-2.0.0.tar.gz cd postgis-2.0.0 ./configure make make comments make cheatsheets sudo make install sudo make comments-install #//--Create postgis database and install postGIS sql functions cd /usr/local/pgsql/data su postgres pg_ctl -D . -l logfile stop exit sudo rm -rf ./* su postgres initdb -D . pg_ctl -D . -l logfile start cat logfile createdb geocoder psql -d geocoder -f /usr/local/pgsql/share/contrib/postgis-2.0/postgis.sql 2>&1 | less psql -d geocoder -f /usr/local/pgsql/share/contrib/postgis-2.0/postgis_comments.sql 2>&1 | less psql -d geocoder -f /usr/local/pgsql/share/contrib/postgis-2.0/spatial_ref_sys.sql 2>&1 | less psql -d geocoder -f /usr/local/pgsql/share/contrib/postgis-2.0/rtpostgis.sql 2>&1 | less psql -d geocoder -f /usr/local/pgsql/share/contrib/postgis-2.0/raster_comments.sql 2>&1 | less psql -d geocoder -f /usr/local/pgsql/share/contrib/postgis-2.0/topology.sql 2>&1 | less psql -d geocoder -f /usr/local/pgsql/share/contrib/postgis-2.0/topology_comments.sql 2>&1 | less