- 1 What is pgAdmin?
- 2 How to install pgAdmin4 in Ubuntu
- 3 Check installation and configure pgAdmin4
- 4 Create the PostGIS extension in a database
How to install pgAdmin 4 in Ubuntu for PostGIS
This short article shows the process to be able install pgAdmin4 in Ubuntu, as well as its validation and configuration for its implementation to work with Space Databases based on PostgreSQL and PostGIS.
What is pgAdmin?
PgAdmin version 4 (pgAdmin4) is the most recent and, unlike its predecessors, written in C + +, it is written in Python.
The application allows us to carry out all kinds of tasks of management, consultation and analysis of information stored in databases, also with geographic information.
Within the sector GIS open source, it is very common to use pgAdmin as a Database Management System ( RDBMS ).
In fact, it is specifically intended for combination with PostgreSQL, on which to implement PostGIS.
It has a clean, friendly design and is easy to configure. In addition, it includes support for visualize GIS cartographic layers vector type, which is a great point in their favor for GIS professionals.
Once PostgreSQL and PostGIS are installed on our machine Ubuntu, we can move on to install pgAdmin4. Let’s see how to perform its installation.
If you still don’t have PostgreSQL and PostGIS, we recommend that you review our article on the installation process of PostGIS in Linux to start working with spatial databases.
How to install pgAdmin4 in Ubuntu
For install pgAdmin4 in Ubuntu, we must first copy the certificates and password with the following command:
Subsequently, we will enter the following command, replacing « bionic » with the Ubuntu version that we have installed.
To know for sure the name of the Ubuntu version if we do not know it, we must enter the command:
In our case, this is version 18.04 Bionic. Thus, we will specify the name of the version in the command as follows:
If your version is different, you should replace “ bionic ” with the name that the previous command returned. The same with the following command:
Below we will update the packages and install pgadmin4:
The download and installation of pgAdmin4 packages. The process may take a few minutes.
Check installation and configure pgAdmin4
We will try to start pgAdmin4 from the browser, in our case installed on localhost and port 4326 by default.
We can do it manually by launching the program or from the console by entering the command:
In case it does not allow opening with your default browser, you can change the order from Configuration > Runtime > Browser Command and insert:
or, depending on the browser you want to use:
With this you should be able to access the pgAdmin4 web interface with your browser.
Create the PostGIS extension in a database
Once opened pgAdmin4 access the server you have available and / or create / connect to a database from the side tree menu.
Having selected the database, check that it allows establishing the PostGIS integration, generating a new one SQL query:
If it doesn’t return any errors and pgAdmin4 validates the query, everything should be correct. You can make sure by going to the selected database > Extensions > postgis.
At this time the database is ready to admit and work with spatial data for storage, analysis and transformation from pgAdmin4.
There should be the created extension, enabling all the functions that PostGIS provides to PostgreSQL.
If you want know more about PostGIS, you can review our article that includes the 25 main functions for spatial analysis that incorporates the PostGIS extension.
Also, once the installation and configuration of PostGIS and pgAdmin4 has been carried out, we can connect this graphic tool to manage databases with QGIS, the most popular OpenSource desktop GIS.
Connect both components for geoinformation work using Geographic Information Systems and spatial databases is a great advantage for most GIS projects.