raster2pgsql command not found
Introduction
When you run more command in linux terminal / console, you get the following error message
raster2pgsql: command not found
or when using sudo you get the following error message
sudo: raster2pgsql: command not found
Solutions to raster2pgsql: command not found
How To Fix raster2pgsql: command not found in Ubuntu / Debian / Kali Linux / Raspbian
In Ubuntu raster2pgsql is provided by postgis package.
postgis is:
PostGIS adds support for geographic objects to the PostgreSQL object-relational database. In effect, PostGIS “spatially enables” the PostgreSQL server, allowing it to be used as a backend spatial database for geographic information systems (GIS), much like ESRI’s SDE or Oracle’s Spatial extension. PostGIS follows the OpenGIS “Simple Features Specification for SQL”.
This package contains the PostGIS userland binaries for importing and exporting shape and raster files: pgsql2shp, raster2pgsql, and shp2pgsql.
To fix this problem, we can install more using the command below.
sudo apt-get -y install postgis
This command might take some time to finish depending on your machine internet connection.
You can also use apt command to install postgis.
sudo apt -y install postgis
Or if you have aptitude installed you can use the following command.
sudo aptitude install postgis
Summary
In this tutorial we learn how to fix raster2pgsql command not found error in Ubuntu / Debian / Kali Linux or Raspbian distribution.