How to install PostgreSql

You may want to install PostgreSQL from an official repository, since it is updated more frequently than official Ubuntu sources.

First, you should install prerequisite software packages that will be used to download and install software certificates for a secure SSL connection.

sudo apt install wget ca-certificates

Then, get the certificate, add it to apt-key management utility and create a new configuration file with an official PostgreSQL repository address inside.

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

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

It is always a good idea to download information about all packages available for installation from your configured sources before the actual installation.

sudo apt update

Now is the time to do the actual PostgreSQL installation. This will install the latest PostgreSQL version along with the newest extensions and additions that are not yet officially part of the PostgreSQL core.

apt install postgresql postgresql-contrib

#Check PostgreSQL status

After the installation you may double-check that postgresql daemon is active.

service postgresql status

The output should look like this:

PostgreSQL status

If you need assistance with your projects feel free to email me at info@airgad.com or whatsapp Jesse stay safe!