Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save shazaum/66f249e03e03ba70827eaafef9ca88d5 to your computer and use it in GitHub Desktop.
Save shazaum/66f249e03e03ba70827eaafef9ca88d5 to your computer and use it in GitHub Desktop.
#
# First Login on PostgreSQL 9.6.4
#
# configuration files on Ubuntu - /etc/postgresql/9.6/main
# configuration files on CentOS - ##
# pg_hba.conf file - add this lines for remote connection
host all all 0.0.0.0/0 md5
host all all ::/0 md5
# postgresql.conf file - modify line to
listen_addresses = '*'
# alter password for postgres user
$ su -u postgres psql
\password postgres
\q
# Verify extensions on PostgreSQL
postgres=# select name, default_version, installed_version from pg_available_extensions;
# create directory for devops
$ sudo mkdir -p /var/<company>/devops
$ cd /var/<company>/devops
# enable extensions on postgresql-server
$ yum search ossp
$ yum install uuid-devel
# for compilation
# $ yum install cmake
# $ yum install gcc
#
# Install pre-requisite software for PostGIS from source
# more details on http://postgis.net/source/
# Short Version -- http://postgis.net/docs/postgis_installation.html#install_short_version
#
#
# GEOS - https://trac.osgeo.org/geos
$ wget http://download.osgeo.org/geos/geos-3.6.2.tar.bz2
$ tar jxf geos-3.6.2.tar.bz2
$ cd geos-3.6.2
$ ./configure
$ make
$ make install
$ make check
# PROJ4 - http://proj4.org/index.html
$ wget http://download.osgeo.org/proj/proj-4.9.3.tar.gz
$ tar -zxvf proj-4.9.3.tar.gz
$ cd proj-4.9.3
$ ./configure
$ make
$ make install
# GDAL - http://gdal.org/
$ wget http://download.osgeo.org/gdal/CURRENT/gdal-2.2.2.tar.gz
$ tar -zxvf gdal-2.2.2.tar.gz
$ cd gdal-2.2.2
$ ./configure
$ make
$ make install
# LibXML2 - http://www.xmlsoft.org/
$ yum install libxml2
# JSON-C - https://github.com/json-c/json-c
# download de zipfile from GIT and follow Build instructions on Git Page
### Troubleshoot ###
# could not find xml2-config from libxml2 within the current path.
# You may need to try re-running configure with a --with-xml2config parameter
yum install libxml2-devel
# download the PostGIS 2.4
$ wget http://download.osgeo.org/postgis/source/postgis-2.4.1.tar.gz
$ cd postgis-2.4.1
$ ./configure --with-uuid=ossp --prefix=/opt/postgresql-9.6.4/ # postgresql source - /root/postgresql-9.6.4
# OR ./configure --with-uuid=ossp --with-pgconfig=/opt/postgresql/bin/pg_config
$ make
$ make install
$ make check
# if not install uuid-ossp run make on folder - /root/postgresql-9.6.4/contrib/uuid-ossp
# for postgis follow - http://postgis.net/source/
# more details to compile entire source on https://postgis.net/docs/manual-1.4/ch02.html
# on postgis the --prefix was broken (./configure) instead use the statement:
# ./configure --with-pgconfig=/opt/postgresql-9.6.4/bin/pg_config
# Geos installation on centos6
# to install without problems about
# ERROR: could not load library "/usr/local/pgsql/lib/postgis-2.0.so": libgeos_c.so.1: cannot open shared object file: No such file or directory
$ ./configure
$ make clean
$ make
$ make install
$ ldconfig
$ vim /etc/ld.so.conf
# add the line:
/usr/local/lib
$ /sbin/ldconfig
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment