Forked from hervenivon/awazon-linux-gdal-installation.sh
Created
October 24, 2019 03:55
-
-
Save johnbaums/23815990a93eec05d91d11ad9eea3af8 to your computer and use it in GitHub Desktop.
Install GEOS, PROJ4 & GDAL on amazon linux
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export PYTHON_VERSION=3.4.3 | |
export PYTHON_SHORT_VERSION=3.4 | |
export GEOS_VERSION=3.6.2 | |
export GDAL_VERSION=2.2.2 | |
export PROJ4_VERSION=4.9.3 | |
sudo yum-config-manager --enable epel | |
sudo yum install gdal-python | |
sudo yum -y install make automake gcc gcc-c++ libcurl-devel proj-devel geos-devel | |
# Compilation work for geos | |
mkdir -p "/tmp/geos-${GEOS_VERSION}-build" | |
cd "/tmp/geos-${GEOS_VERSION}-build" | |
curl -o "geos-${GEOS_VERSION}.tar.bz2" \ | |
"http://download.osgeo.org/geos/geos-${GEOS_VERSION}.tar.bz2" \ | |
&& bunzip2 "geos-${GEOS_VERSION}.tar.bz2" \ | |
&& tar xvf "geos-${GEOS_VERSION}.tar" | |
cd "/tmp/geos-${GEOS_VERSION}-build/geos-${GEOS_VERSION}" | |
./configure --prefix=/usr/local/geos | |
# Make in parallel with 2x the number of processors. | |
make -j $(( 2 * $(cat /proc/cpuinfo | egrep ^processor | wc -l) )) \ | |
&& sudo make install \ | |
&& sudo ldconfig | |
# Compiltation worf for proj4 | |
mkdir -p "/tmp/proj-${PROJ4_VERSION}-build" | |
cd "/tmp/proj-${PROJ4_VERSION}-build" | |
curl -o "proj-${PROJ4_VERSION}.tar.gz" \ | |
"http://download.osgeo.org/proj/proj-${PROJ4_VERSION}.tar.gz" \ | |
&& tar xfz "proj-${PROJ4_VERSION}.tar.gz" | |
cd "/tmp/proj-${PROJ4_VERSION}-build/proj-${PROJ4_VERSION}" | |
./configure --prefix=/usr/local/proj4 | |
# Make in parallel with 2x the number of processors. | |
make -j $(( 2 * $(cat /proc/cpuinfo | egrep ^processor | wc -l) )) \ | |
&& sudo make install \ | |
&& sudo ldconfig | |
# Compilation work for GDAL | |
pip${PYTHON_SHORT_VERSION} install numpy | |
mkdir -p "/tmp/gdal-${GDAL_VERSION}-build" | |
cd "/tmp/gdal-${GDAL_VERSION}-build" | |
curl -o "gdal-${GDAL_VERSION}.tar.gz" \ | |
"http://download.osgeo.org/gdal/${GDAL_VERSION}/gdal-${GDAL_VERSION}.tar.gz" \ | |
&& tar xfz "gdal-${GDAL_VERSION}.tar.gz" | |
cd "/tmp/gdal-${GDAL_VERSION}-build/gdal-${GDAL_VERSION}" | |
./configure --prefix=/usr/local/gdal \ | |
--with-curl=yes \ | |
--with-static-proj4=/usr/local/proj4 \ | |
--with-python=yes | |
# Make in parallel with 2x the number of processors. | |
make -j $(( 2 * $(cat /proc/cpuinfo | egrep ^processor | wc -l) )) \ | |
&& sudo make install \ | |
&& sudo ldconfig | |
# Configuring environment | |
export PATH="/usr/local/gdal/bin:$PATH" | |
export LD_LIBRARY_PATH="/usr/local/proj4/lib:/usr/local/gdal/lib:$LD_LIBRARY_PATH" | |
export GDAL_DATA="/usr/local/gdal/share/gdal" | |
cd swig/python/ | |
python${PYTHON_SHORT_VERSION} setup.py build | |
sudo python${PYTHON_SHORT_VERSION} setup.py install |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment