GIS Tutorial
  • Home
  • About
  • Contact

Popular Posts

How to open Mapinfo TAB file on QGIS
QGIS,

How to open Mapinfo TAB file on QGIS

by adminJanuary 1, 20181 comment
How to Export Layer to Shapefile on QGIS
QGIS,

How to Export Layer to Shapefile on QGIS

by adminSeptember 21, 2018no comment
How to Create a GeoPackage on QGIS 3.2
QGIS,

How to Create a GeoPackage on QGIS 3.2

by adminJuly 25, 2018no comment
How to convert polyline to polygon on QGIS 3.0
QGIS,

How to convert polyline to polygon on QGIS 3.0

by adminJune 12, 2018no comment

Category List

  • ArcGIS (83)
  • Database (58)
  • Free Spatial Data (2)
  • General (6)
  • Geoserver (2)
  • GIS Software (23)
  • Global Mapper (20)
  • Leapfrog Geo (16)
  • Linux (9)
  • macOS (2)
  • Mapinfo (40)
  • Micromine (32)
  • Oracle (6)
  • Programming (8)
  • QGIS (105)
  • Software Review (2)
  • Surfer (2)
  • Uncategorized (6)

Follow Us

Instagram

Instagram has returned invalid data.
GIS Tutorial
  • Home
  • About
  • Contact
Database, Linux,

Install PostgreSQL on Debian 11

by adminJune 17, 20231 comment
0
Shares
Share on FacebookShare on Twitter

As a GIS specialist, ArcGIS is my main tool to create maps, doing some spatial analysts and so on. ArcGIS supports various databases including PostgreSQL (PostGIS), SQL Server, Oracle and some more. In this article, I am going to build a database system to support my work. I will build a PostgreSQL on Debian 11. This system is running on Linode. So basically it’s a cloud system. Linode offers a low-cost cloud VM that is great for a starter.

Steps to Install PostgreSQL on Debian 11

Step 1. Update System

First, we need to update our system prior to the PostgreSQL installation. Connect to the host via SSH. I would recommend Termius to connect to the remote/cloud system. Execute this command to update Debian 11.

sudo apt update && sudo apt upgrade

Step 2. Install PostgreSQL

Now we are ready to install PostgreSQL. Use this command.

sudo apt install postgresql postgresql-contrib

Wait until the installation completes

Step 3. Start PostgreSQL

Now we can start the PostgreSQL service and see the status with this command

sudo systemctl start postgresql
sudo systemctl status postgresql

Output

Step 4. Create a New Database

First, we need to connect to the PostgreSQL database locally.

sudo -i -u postgres

And then, run the psql command

psql

Output

Now let’s create a new PostgreSQL user called ‘dhani’ with password ‘12345’.

CREATE USER dhani WITH PASSWORD '12345';

Now we are going to create a new database called gis_database.

CREATE DATABASE gis_database;

Now we have a new database ready. Now we can grant the new user to the new database we created.

GRANT ALL PRIVILEGES ON DATABASE gis_database TO dhani;

Step 5. Enable Remote Access

By default, PostgreSQL only be accessible from the localhost. With a few clicks, we can enable remote access so our applications can connect to the database remotely. As root or sudo users, we need to edit the postgresql.conf file.

nano /etc/postgresql/13/main/postgresql.conf  

Scroll down and find the following line

listen_addresses = 'localhost'

Change it into:

listen_addresses = '*'

Next, we need to edit the pg_hba.conf.

nano /etc/postgresql/13/main/pg_hba.conf

Scroll down until you see this line

host    replication     all             127.0.0.1/32            md5

Change it to:

host    replication     all             0.0.0.0/0            md5

Close and save the file and then restart PostgreSQL service.

sudo systemctl restart postgresql

In case you have firewall active, we need to allow port 5432 through the ufw.

sudo ufw allow 5432
debianpostgresql
Previous

How to Install Debian Linux on Mac M1 and M2

June 15, 2023
Next

How to Run Microsoft SQL Server Docker on Mac M1

June 18, 2023

1 Comment

How to Install PostGIS on Debian 12 - GIS Tutorial

October 10, 2023

[…] my previous article, we learned about how to install PostgreSQL on Debian 12. Now, as a GIS, I want to expand my database server capabilities. PostGIS allows us to store the […]

Reply

Leave a Reply Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Trending

  • How to Install Microsoft SQL Server Driver for Tableau in Apple Silicon Mac

    How to Install Microsoft SQL Server Driver for Tableau in Apple Silicon Mac

    1 month ago
  • Step by Step Installing Oracle Spatial Studio on Windows Server 2022

    Step by Step Installing Oracle Spatial Studio on Windows Server 2022

    3 months ago
  • Install GeoServer on Windows 11

    Install GeoServer on Windows 11

    3 months ago
  • How Enable GeoRaster Support on Oracle Database Schema

    How Enable GeoRaster Support on Oracle Database Schema

    3 months ago

Ads




Ads




Pages