How to Install PostgreSQL 11 on Ubuntu 19.04

Installation of PostgreSQL 11 on Ubuntu 19.04

Download Link :

wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -

Installation

Run the following command to import the GPG key for PostgreSQL packages.

root@linuxhelp:~# wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
OK

And then, add the repository to your system.

root@linuxhelp:~# sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" >> /etc/apt/sources.list.d/pgdg.list'

Install PostgreSQL on Ubuntu.

root@linuxhelp:~# apt install postgresql postgresql-contrib -y
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  libllvm7 libpq5 postgresql-11 postgresql-client-11 postgresql-client-common postgresql-common sysstat
Suggested packages:
  postgresql-doc postgresql-doc-11 libjson-perl isag
The following NEW packages will be installed:
  libllvm7 libpq5 postgresql postgresql-11 postgresql-client-11 postgresql-client-common postgresql-common
.
.
.
.
.
.
Processing triggers for systemd (240-6ubuntu5) ...
Processing triggers for man-db (2.8.5-2) ...
Processing triggers for libc-bin (2.29-0ubuntu2) ...

After the installation of the postgresql database server, by default, it creates a user postgres and creates an account with role postgres.

root@linuxhelp:~# su – postgres

Connect to PostgreSQL 11 by triggering the following command.

%postgres@linuxhelp:~$ psql%
psql (11.3 (Ubuntu 11.3-0ubuntu0.19.04.1))
Type "help" for help.

postgres=# \conninfo
You are connected to database "postgres" as user "postgres" via socket in "/var/run/postgresql" at port "5432".
postgres=# \q

Once it is done, check the listening port of PostgreSQL by executing the followong command.

postgres@linuxhelp:~$ ss -atulpn | grep postgres
tcp    LISTEN   0        128             127.0.0.1:5432           0.0.0.0:*      users:(("postgres",pid=35697,fd=3)) 

With this, the installation of PostgreSQL 11 on Ubuntu 19.04 comes to end.

FAQ
Q
What is WAL XLOG in PostgreSQL?
A
In PostgreSQL, the history data are known as XLOG records or WAL data.
Q
What does streaming replication mean in PostgreSQL?
A
The streaming replication provides the capability to continuously ship and applies the WAL XLOG records to some number of standby servers in order to keep them current in PostgreSQL.
Q
What are the features of PostgreSQL?
A
Complex SQL queries
SQL Subselects
Foreign Keys
Trigger views
Transactions
Multiversion currency COntrol
Streaming Replication
Hot Standby
Q
What are the main differences between MySQL and PostgreSQL?
A
The governance model is the main difference between MySQL and PostgreSQL. MySQL is controlled by Oracle whereas Postgres is available under an open-source license from the PostgreSQL Global Development Group
Q
What is the use of PostgreSQL?
A
PostgreSQL is a general purpose object-relational database management system. It allows users to add custom functions developed using different programming languages such as C/C++, Java, etc.