Open Source Database
How to Install Postgresql with PostGis for Non-root user with libxml support PDF Print E-mail
Programming - Open Source Database

PostGresql Installation

  1. Make sure you "make clean" if you ran into any problem before starting a fresh installation
  2. Get the source code of PostGresql by clicking here
  3. Unzip the postgresql source files
  4. Change the folder by using command cd <folder where the zip file is uncompressed>
  5. configure --prefix=<Folder of the installation Folder where you want your postgresql to be installed> --with-libxml
  6. make
  7. make check
  8. export LD_LIBRARY_PATH=<the installation folder>/lib
  9. <installation Folder>/bin/initdb -D <installation Folder>/data
  10. <installation Folder>/bin/postmaster -D <installation Folder>/data for verbose run

OR

<installation Folder>/bin/pg_ctl -D <installation Folder>/data -l /tmp/pgsql.log start for silent run

PostGis Installation

  1. Install Goes and PROJ dependencies.
  2. Make sure the postgresql is installed and ready to accept connection
  3. configure --with-geosconfig=<Path to folder where you have installed Geos library>/bin/geos-config --with-projdir=<Path to Folder where you have installed Proj library>
  4. make check
  5. if you get error like
  6. ERROR:  function postgis_lib_version() does not exist
    LINE 1: select postgis_lib_version()
    then Copy files in <path to folder wher Proj library is installed>/lib/ to the lib folder of postgresql Installation
  7. make install

 

Create a spatially enabled database:

go to the in folder of Postgresql installation
a) createdb [yourdatabase]

b) createlang plpgsql [yourdatabase]

c) psql -d [yourdatabase] -f postgis.sql
d) psql -d [yourdatabase] -f spatial_ref_sys.sql
if you get error like files postgis.sql or spatial_ref_sys.sql not found: give the complete path <postgresql installation folder>/share/contrib/postgis-1.5/