Skip to content

Instantly share code, notes, and snippets.

@WillEngler
Last active June 20, 2019 09:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save WillEngler/8a3a20591e2cdbee2861d2d342e2dac5 to your computer and use it in GitHub Desktop.
Save WillEngler/8a3a20591e2cdbee2861d2d342e2dac5 to your computer and use it in GitHub Desktop.
Build GDAL from source with Postgres support on AWS Linux

How to make custom Elastic Beanstalk AMI

  1. Start environment with your desired configuration (e.g. Python 3.4)
  2. Find generated instance in EC2 console. The AMI ID is your base image.
  3. Launch an instance from the base AMI (It will be in the list of community AMISs)
  4. Provision that instance.
  5. Make an AMI from it. Use the AMI ID in your beanstalk environment configuration.
#! /bin/bash
sudo yum install -y gcc-c++
sudo yum install -y gcc
sudo yum install -y libpng
sudo yum install -y libtiff
sudo yum install -y postgresql95-devel
sudo yum install -y git
sudo yum install -y libffi-devel
sudo yum install -y libxml2-devel
sudo yum install -y libxslt-devel
sudo yum install -y htop
wget http://download.osgeo.org/proj/proj-4.9.3.tar.gz
tar -zvxf proj-4.9.3.tar.gz
cd proj-4.9.3
./configure
make -j 2
sudo make install
cd ..
rm proj-4.9.3.tar.gz
wget http://download.osgeo.org/gdal/2.1.2/gdal-2.1.2.tar.gz
tar -zvxf gdal-2.1.2.tar.gz
cd gdal-2.1.2
./configure --with-static-proj4=/usr/local/lib --with-threads --with-pg=/usr/bin/pg_config
make -j 2
sudo make install
cd ..
rm gdal-2.1.2.tar.gz
sudo ln -s /usr/bin/ogr2ogr /usr/bin/ogr2ogr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment