How to Install PostGIS on Debian 9
Hello everyone, welcome to GIS Tutorial. Today we are going to learn about how to install PostGIS on Debian 9. PostGIS is a spatial extension of the PostgreSQL Server. With PostGIS extension, we can store layers with spatial information directly to PostgreSQL Server. PostGIS can be installed on Windows as well as in Linux. Before we can install PostGIS, you will need a PostgreSQL database. The extension is database specific. So, if you have multiple databases in your server, you will need to enable PostGIS one by one on those databases.
Before we go through the installation, let’s take a look at the Postgis. Postgis is a spatial database extender for PostgreSQL. It adds support to geographic information to PostgreSQL. In other word, you can store lines, multiline, polygon layers directly to PostgreSQL.
- PostgreSQL Server and a database/schema
- root password for the Debian 9
Steps to Install PostGIS on Debian 9
I assume you have installed PostgreSQL Server on Debian 9. If not, you can follow this tutorial to Install PostgreSQL Server on Debian 9. Next, use this command as root to install postgis package
apt install postgis
Wait a few moments until the installation is completed.
Enable Postgis extension on a database
Now we need to enable the postgis extension on each database we want to use to store the spatial datasets. The easiest way is to use PgAdmin. On the following video, you will see how to enable the postgis extension on a database. Please do this after you install postgis using the command above.
At this point, our PostgreSQL database is now ready to store the spatial datasets.