Skip to content

Instantly share code, notes, and snippets.

@joakimsk
Forked from whyvez/install-postgis.sh
Last active January 15, 2018 10:54
Show Gist options
  • Save joakimsk/a493f9708a806651f9b906da83d897c7 to your computer and use it in GitHub Desktop.
Save joakimsk/a493f9708a806651f9b906da83d897c7 to your computer and use it in GitHub Desktop.
postGIS install on AWS linux AMI
#!/bin/bash
# Script to setup an Elastic Beanstalk AMI with geospatial libraries and postGIS, extra python3
# Stable releases as of 15. January 2018
# Go to ec2-user home directory
cd /home/ec2-user
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 openssl-devel python27 python27-devel\
python36 python36-devel yum-utils
# POSTGRESQL 10.1
wget https://ftp.postgresql.org/pub/source/v10.1/postgresql-10.1.tar.gz && wget https://ftp.postgresql.org/pub/source/v10.1/postgresql-10.1.tar.gz.md5 && md5sum -c *.md5
tar -zxvf postgresql-10.1.tar.gz
cd postgresql-10.1
./configure --with-openssl --with-pgport=10010 --with-python --bindir=/usr/bin
make
sudo make install
cd ..
# PROJ 4.9.3
# NB: The MD5 sum contains wrong filename - Must be verified manually
wget http://download.osgeo.org/proj/proj-4.9.3.tar.gz && wget http://download.osgeo.org/proj/proj-4.9.3.tar.gz.md5
tar -zxvf proj-4.9.3.tar.gz
cd proj-4.9.3
./configure
make
sudo make install
cd ..
# GEOS 3.6.2
# NB: No MD5 sum
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 1.11.5 - Uncomment if you want it
#wget http://download.osgeo.org/gdal/1.11.5/gdal-1.11.5.tar.gz
#tar -zxvf gdal-1.11.5.tar.gz
#cd gdal-1.11.5
#./configure
#make
#sudo make install
#cd ..
# GDAL 2.2.3
wget http://download.osgeo.org/gdal/2.2.3/gdal-2.2.3.tar.gz && wget http://download.osgeo.org/gdal/2.2.3/gdal-2.2.3.tar.gz.md5 && md5sum -c
tar -zxvf gdal-2.2.3.tar.gz
cd gdal-2.2.3
./configure
make
sudo make install
cd ..
# POSTGIS 2.4.2
# NB: No MD5, unsure if LD_LIBRARY is enough
export LD_LIBRARY_PATH=/usr/local/pgsql/lib/:LD_LIBRARY_PATH
wget http://download.osgeo.org/postgis/source/postgis-2.4.2.tar.gz
tar -xvf postgis-2.4.2.tar.gz
cd postgis-2.4.2
./configure
make
sudo make install
cd ..
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment