Skip to content

Instantly share code, notes, and snippets.

@r35krag0th
Created May 14, 2018 20:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save r35krag0th/496012f6cfddd7d755d9924627e06855 to your computer and use it in GitHub Desktop.
Save r35krag0th/496012f6cfddd7d755d9924627e06855 to your computer and use it in GitHub Desktop.
GDAL 2.1.0 on AWS Linux 2017.09
#!/usr/bin/env bash
# Upgrade everything
sudo yum -y update
# Enable EPEL Repo
sudo yum-config-manager --enable epel
# Install the required packages for compilation
sudo yum install make automake gcc gcc-c++ libcurl-devel proj-devel geos-devel python-devel
# Create a working directory for compilaton
mkdir -p $HOME/src
cd $HOME/src/
# Download a copy of GDAL's source for building
curl -L http://download.osgeo.org/gdal/2.1.0/gdal-2.1.0.tar.gz | tar xvzf -
cd ${HOME}/src/gdal-2.1.0/
# Configure it with some minimal details
./configure --with-python --prefix=/usr/local
# Compile the source
make -j4
# Install it; the INSTALL_LAYOUT=amzn helps with the --install-layout=deb "bug"
sudo make install INSTALL_LAYOUT=amzn
# Have pip install pygdal matching this version of gdal
# --> NOTE: PATH has to be modified because pip won't find gdal-config, which lives in /usr/local/bin
# --> NOTE: GDALHOME has to be set so that pygdal can find the appropriate prefix; this is kind of redundant
# BUT is nice to have everything stapled down.
sudo env PATH=/usr/local/bin:$PATH GDALHOME=/usr/local /usr/local/bin/pip install 'pygdal>=2.1.0,<2.1.1'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment