Hello everyone, welcome to our GIS Tutorial. In this tutorial, I am going to show you how to install PostGIS on Ubuntu 18.04 Bionic Beaver. Before we go through the installation steps, let’s have a look at PostGIS. PostGIS is a special spatial extension for PostgreSQL. With this extension, we can store spatial and geometry information to a table or database. PostGIS is a powerful way to store our GIS datasets. PostGIS extension is not enabled by default on standard PostgreSQL installation. We need to enable the extension on each database we want.
This tutorial is based on Ubuntu 18.04. It could be slightly different on other systems. Most of the installation processes uses Terminal command. But I don’t think it is complicated. Please follow each steps on this tutorial to install PostGIS on Ubuntu 18.04. I have been using my PostGIS until now and found no issues.
What you will learn
- Install PostgreSQL on Ubuntu
- Install PostGIS on Ubuntu
- Enable PostGIS extension
Lesson 1. Install PostgreSQL
Skip this step if you have PostgreSQL installed. To install PostgreSQL on Ubuntu 18.04, follow these steps.
- Download PostgreSQL package for Linux by EnterpriseDB
- Make the package executable
sudo chmod +x postgresql-9.6.9-1-linux-x64.run
- Run the installer
sudo ./postgresql-9.6.9-1-linux-x64.run
- The GUI installation wizard will open up.
Specify the installation directory. Leave the default value if you don’t want to change the location.
Specify the data directory
Provide password for the postgres superuser
Wait until the installation is completedIn some cases, due to missing dependencies, the StackBuilder won’t come up. StackBuilder is an additional tool that helps us to add some functionality to PostgreSQL.
Lesson 2. Install PostGIS on Ubuntu 18.04
On the previous lesson, you have successfully installed PostgreSQL on Ubuntu 18.04. Now, let’s continue to install postgis on Ubuntu 18.04. Use the following command to install postgis
sudo apt install postgis
Output
Now Install PgAdmin4. PgAdmin is a web-based tool to manage PostgreSQL server.
sudo apt install pgadmin4
After this, there should be a PgAdmin4 icon in your Ubuntu applications list. Open it to start configuring the server.
Lesson 3. Create New Database via PgAdmin4
Open PgAdmin4 and watch the following video to connect to PostgreSQL and create a new database. On the following video, you can also see how to create or enable postgis extension on a database.
You will need to open this video from a PC. Otherwise, the video will not play.
Conclusion
On this tutorial, we learned few things: install PostgreSQL, PgAdmin4, PostGIS and then enable postgis extension on a database. This tutorial is far from a good tutorial but I hope this tutorial is useful for anyone who wants to install PostGIS on Ubuntu 18.04. Maybe I will post more stuff like this in the future.
Kartik
August 14, 2018Thanks for the concise tutorial. Was helpful.
Tony Zoccolillo
October 25, 2018Fantastic! This is the best how to install I found anywhere. This one actually worked first try. Thanks so much.
dunno
April 13, 2019Why not just “sudo apt-get install postgresql” and go with version 10?
A Beginners Guide to PostGIS and Global Mapper | GIS Tutorial
January 10, 2020[…] How to Install PostGIS on Ubuntu 18.04 […]
How to Import a PostGIS Table into ArcMap | GIS Tutorial
April 18, 2020[…] How to Install PostGIS on Ubuntu 18.04 […]