How To Install postgresql-client-12 on Ubuntu 20.04

In this tutorial we learn how to install postgresql-client-12 on Ubuntu 20.04. postgresql-client-12 is front-end programs for PostgreSQL 12 front-end programs for PostgreSQL 12

Introduction

In this tutorial we learn how to install postgresql-client-12 on Ubuntu 20.04.

What is postgresql-client-12

postgresql-client-12 is:

This package contains client and administrative programs for PostgreSQL: these are the interactive terminal client psql and programs for creating and removing users and databases.

This is the client package for PostgreSQL 12. If you install PostgreSQL 12 on a standalone machine, you need the server package postgresql-12, too. On a network, you can install this package on many client machines, while the server package may be installed on only one machine.

PostgreSQL is an object-relational SQL database management system. Task: postgresql-server

Package: postgresql-client-12 Architecture: amd64 Version: 12.2-4 Multi-Arch: foreign Priority: optional Section: database Source: postgresql-12 Origin: Ubuntu Maintainer: Ubuntu Developers [email protected] Original-Maintainer: Debian PostgreSQL Maintainers [email protected] Bugs: https://bugs.launchpad.net/ubuntu/+filebug Installed-Size: 3660 Provides: postgresql-client Depends: libpq5 (>= 12.2), postgresql-client-common (>= 182~), sensible-utils, libc6 (>= 2.17), libedit2 (>= 3.1-20180525-0), zlib1g (>= 1:1.1.4) Suggests: postgresql-12, postgresql-doc-12 Conflicts: postgresql-server-dev-12 (« 12.1-2~) Replaces: postgresql-server-dev-12 (« 12.1-2~) Filename: pool/main/p/postgresql-12/postgresql-client-12_12.2-4_amd64.deb Size: 1041704 MD5sum: abe0b454eda6cde5e3831ac67e9b161c SHA1: 1381873b7788200bcce106e283419190d737eda1 SHA256: f77288f70779867455c0ddfb69d3e7cc8dbff39021a97de6f8e88c81dda5a970 Homepage: http://www.postgresql.org/ Description-en: front-end programs for PostgreSQL 12 This package contains client and administrative programs for PostgreSQL: these are the interactive terminal client psql and programs for creating and removing users and databases.

This is the client package for PostgreSQL 12. If you install PostgreSQL 12 on a standalone machine, you need the server package postgresql-12, too. On a network, you can install this package on many client machines, while the server package may be installed on only one machine.

PostgreSQL is an object-relational SQL database management system. Task: postgresql-server

There are three methods to install postgresql-client-12 on Ubuntu 20.04. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.

Install postgresql-client-12 Using apt-get

Update apt database with apt-get using the following command.

sudo apt-get update

After updating apt database, We can install postgresql-client-12 using apt-get by running the following command:

sudo apt-get -y install postgresql-client-12

Install postgresql-client-12 Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install postgresql-client-12 using apt by running the following command:

sudo apt -y install postgresql-client-12

Install postgresql-client-12 Using aptitude

If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Ubuntu. Update apt database with aptitude using the following command.

sudo aptitude update

After updating apt database, We can install postgresql-client-12 using aptitude by running the following command:

sudo aptitude -y install postgresql-client-12

How To Uninstall postgresql-client-12 on Ubuntu 20.04

To uninstall only the postgresql-client-12 package we can use the following command:

sudo apt-get remove postgresql-client-12

Uninstall postgresql-client-12 And Its Dependencies

To uninstall postgresql-client-12 and its dependencies that are no longer needed by Ubuntu 20.04, we can use the command below:

sudo apt-get -y autoremove postgresql-client-12

Remove postgresql-client-12 Configurations and Data

To remove postgresql-client-12 configuration and data from Ubuntu 20.04 we can use the following command:

sudo apt-get -y purge postgresql-client-12

Remove postgresql-client-12 configuration, data, and all of its dependencies

We can use the following command to remove postgresql-client-12 configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge postgresql-client-12

References

Summary

In this tutorial we learn how to install postgresql-client-12 package on Ubuntu 20.04 using different package management tools: apt, apt-get and aptitude.