Skip to content

Instantly share code, notes, and snippets.

@ejokeeffe
Forked from whyvez/install-postgis.sh
Last active November 2, 2017 12:11
Show Gist options
  • Save ejokeeffe/2afe4357b4da7224dd601af7e96909d2 to your computer and use it in GitHub Desktop.
Save ejokeeffe/2afe4357b4da7224dd601af7e96909d2 to your computer and use it in GitHub Desktop.
postGIS install on AWS linux AMI
#!/bin/bash
#
# Script to setup a Elastic Beanstalk AMI with geospatial libraries and postGIS
#
# sh aws_ami_prep.sh > aws_ami_prep.log 2>&1 &
# Go to ec2-user home directory
cd /home/ec2-user
# yum libraries
sudo yum -y install gcc gcc-c++ make cmake libtool libcurl-devel libxml2-devel rubygems swig fcgi-devel\
libtiff-devel freetype-devel curl-devel libpng-devel giflib-devel libjpeg-devel\
cairo-devel freetype-devel readline-devel
# Postgres
wget http://ftp.postgresql.org/pub/source/v9.6.5/postgresql-9.6.5.tar.gz
tar -zxvf postgresql-9.6.5.tar.gz
cd postgresql-9.6.5
./configure --with-openssl --bindir=/usr/bin
make
sudo make install
cd ..
# PROJ
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
sudo make install
cd ..
# GEOS
wget http://download.osgeo.org/geos/geos-3.6.2.tar.bz2
tar -xvf geos-3.6.2.tar.bz2
cd geos-3.6.2
./configure
make
sudo make install
cd ..
# GDAL
wget http://download.osgeo.org/gdal/2.2.2/gdal-2.2.2.tar.gz
tar -zxvf gdal-2.2.2.tar.gz
cd gdal-2.2.2
./configure
make
sudo make install
cd ..
# PostGIS
# check the below that it conform with your path!!
export LD_LIBRARY_PATH=/usr/local/pgsql/lib/:$LD_LIBRARY_PATH
# it might be something like or similar
export LD_LIBRARY_PATH=/usr/pgsql-9.6/lib/:$LD_LIBRARY_PATH
wget http://download.osgeo.org/postgis/source/postgis-2.4.0.tar.gz
tar -xvf postgis-2.4.0.tar.gz
cd postgis-2.4.0
./configure
make
sudo make install
cd ..
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment