7

Install PostgreSQL 12 + PostGIS on Ubuntu 20.4 in 5 mins.

 2 years ago
source link: https://joets.medium.com/install-postgresql-12-postgis-on-ubuntu-20-4-in-5-mins-1b8948545185
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Tutorial

Install PostgreSQL 12 + PostGIS on Ubuntu 20.4 in 5 mins.

0*M6PqGaOQoG9b5fMz?q=20
install-postgresql-12-postgis-on-ubuntu-20-4-in-5-mins-1b8948545185
Photo by Caspar Camille Rubin on Unsplash

This article is a very short tutorial for installing PostgreSQL 12/ PostGIS on the Ubuntu system. It is a production note which I initially wrote for myself to install PostgreSQL on several machines. The explanation is kept very short and straight to the result.

Step 1: Add and Install the PostgreSQL 12 via your terminal.

$ sudo apt update
$ sudo apt install postgresql-12 postgresql-client-12

Step 2: Test PostgreSQL + Assign password to postgres

$ systemctl status postgresql.service
1*qDzYOXihdtkdCSV-NJxLFQ.png?q=20
install-postgresql-12-postgis-on-ubuntu-20-4-in-5-mins-1b8948545185

Then, connect and change the “postgres” password.

$ sudo -u postgres psql
$ \password postgres
enter strong password twice!

Step 3: Install GnuPG 2.0 and PostGIS

$ sudo sudo apt install gnupg2
$ sudo apt install postgis postgresql-12-postgis-3

Step 4: Set the Client Authentication & Connection

# ========================================
# === Set Listening Port =================
# ========================================
$ nano /etc/postgresql/12/main/postgresql.conf
# listen_addresses = '*' ==> Listen on all interfaces
# listen_addresses = '<ip here>'==> Listen on specified IP address# ========================================
# === Set Client authentication ==========
# ========================================
$ nano /etc/postgresql/12/main/pg_hba.conf
# TYPE DATABASE USER ADDRESS METHOD
# host postgres all 192.168.12.10/32 md5

Step 5: Connect and enjoy PostgreSQL via your favorite GUI!


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK