As of this day, this is probably the only and fastest way of installing it.
Based from the GDAL and PROJ build requirements, here is the full list of required packages to install:
- C++11 -
cpp
version7.3.1
- PROJ 6 -
proj
version6.1.1
- SQLite3 -
sqlite3
version3.7.17
- libtiff - version
4.0
- cmake - version
3.13.1
- SQLite3 -
Installation of these packages are covered in the sections below. However, before you proceed with the installation, make sure you are already logged in to your EC2 Amazon Linux 2 via SSH. After logging in, you just need to issue some statements in the command-line.
Luckilly, we don't have to install everything from source. At least some can be installed through yum.
sudo yum install gcc-c++.x86_64 cpp.x86_64 sqlite-devel.x86_64 libtiff.x86_64 cmake3.x86_64 -y
Installation from source, currently there's no other way but this.
cd /tmp
wget https://download.osgeo.org/proj/proj-6.1.1.tar.gz
tar -xvf proj-6.1.1.tar.gz
cd proj-6.1.1
./configure
sudo make
sudo make install
Be careful not to install PROJ version 6.2.0
or newer because the one from the yum
packages is only SQLite version 3.7.17
. Installing PROJ version 6.2.0
would require installing SQLite version 3.11
which you may need to install from source and not with yum.
Installation from source, currently there's no other way but this.
cd /tmp
wget https://github.com/OSGeo/gdal/releases/download/v3.2.1/gdal-3.2.1.tar.gz
tar -xvf gdal-3.2.1.tar.gz
cd gdal-3.2.1
./configure --with-proj=/usr/local --with-python
sudo make
sudo make install
which gdalinfo; gdalinfo --version
It should show something like
/usr/local/bin/gdalinfo
GDAL 3.2.1, released 2020/12/29
Did I miss something? Are you having some troubles with the installed GDAL? Write them down as comments below. Let's help our selves and others at the same time.
@saheelBreezo, recent GDAL versions install only a minimal set of format drivers by default. Netcdf is not one of the default drivers. Here is a generic method to add a driver to the default installation. This is what @data-ux did above, for the OpenJPEG format.
Find and install the support library needed for your format. In this case the support library is netcdf. Either binary install or build from source should work.
Specify the desired driver(s) in the GDAL configure command. For netcdf format, the added configure option is
--with-netcdf
. Include the optional=path
sub-argument if the format support library is installed in a non-default location. GDAL can support many different drivers in one build, as long as they are all specified in the configure command.After configure, then build, install, and test GDAL according to the rest of the above instructions.
It may be necessary to set PKG_CONFIG_PATH before GDAL configure. Recent netcdf releases include their own netcdf.pc (pkg-config) file, and GDAL configure might be able to find it automatically. I am not sure how to deal with this in the Amazon Linux context, so you might need to look into this. First see if it works without any adjustment for pkg-config.
For more information about optional GDAL drivers, please see the gdal.org website. For more information about configure driver options, please run
./configure --help
.