Skip to content
Home ยป How to Install postgresql-client on Linux?

How to Install postgresql-client on Linux?

  • by

Just as MariaDB requires the mariadb-client package to connect other hosts to a MariaDB database, PostgreSQL also requires the postgresql-client package to connect other hosts to a PostgreSQL database.

 

Problem

How to install postgresql-client on Linux?

 

Solution

Below is the command to install postgresql-client on some Linux distributions:

Ubuntu/Debian

sudo apt update
sudo apt install postgresql-client

 

RockyLinux/AlmaLinux/RHEL/CentOS

sudo yum install postgresql-client

 

Then run the command below to see the installed PostgreSQL version:

psql --version
Check PostgreSQL version

 

As you can see in the image above, the version of postgresql-client that you installed is version 16.10. But you should know that, usually by default, the package provided by the distro is a stable old version and not the latest stable version. Therefore, if you want the mariadb-client package to use the latest stable version, use the command below if you use a Ubuntu/Debian distro:

sudo apt install -y postgresql-common
sudo /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh

 

Then run the command below to install the latest version of postgresql-client (The last version of postgresql in November 2025 is version 18.0):

sudo apt install postgresql-client-18

 

If your distro is using RockyLinux/AlmaLinux/RHEL version 10, use the command below to upgrade the postgresql-client package to the latest version:

sudo dnf remove -y postgresql
sudo dnf install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-10-x86_64/pgdg-redhat-repo-latest.noarch.rpm
sudo dnf clean all
sudo dnf makecache
sudo dnf install -y postgresql18

 

Note

If you want to know how to access the MariaDB database from another host, you can go to this article.

 

References

postgresql.org
docs.risingwave.com
dewanahmed.com

image_pdfimage_print
Visited 26 times, 1 visit(s) today

Leave a Reply

Your email address will not be published. Required fields are marked *