Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
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 | 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