December 23, 2024
Tutorials

How to Install Postgresql 16.0 on Ubuntu 22.04

How to Install Postgresql on Ubuntu 22.04

PostgreSQL is a powerful open-source third-party tool, popular for database management systems. Many developers rely on PostgreSQL due to its advanced features. PostgreSQL also provides a user-friendly interface capable of handling complex queries and ensuring data integrity.

This educational post will provide a detailed insight into how to download and install the PostgreSQL 16.0 package on the Ubuntu 22.04 system.

How to Install Postgresql 16.0 on Ubuntu 22.04?

Install the PostgreSQL 16.0 package on Ubuntu 22.04 by using the guided instructions below.

Update Ubuntu Packages

For Ubuntu users, it is essential to ensure that your system’s packages are updated to the latest one:

sudo apt update

Now, your system is updated to the newest packages.

Add PostgreSQL Repository

To install the newest release of PostgreSQL, first you will need to add the PostgreSQL repository:

sudo sh -c ‘echo “deb https://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main” > /etc/apt/sources.list.d/pgdg.list’

The blank output indicates that the command executed successfully and the repository key for PostgreSQL has been added to your local machine.

Import the PostgreSQL Repository Key

After successfully adding the PostgreSQL repository, import the repository signing key to your system:

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

If you see the “OK” in your output, it means the repository key is also imported and is now ready to install the PostgreSQL package on your Ubuntu 22.04 system.

Install PostgreSQL 16.0

You are now ready to install the newest PostgreSQL release on your Ubuntu 22.04 machine:

sudo apt install postgresql -y

Finally, you will see in your output that PostgreSQL 16.0 is now installed on your Ubuntu 22.04 system.

Confirm PostgreSQL

You can check its version to confirm that PostgreSQL 16.0 has been successfully installed:

pg_config –version

The latest version of PostgreSQL 16.0 is now available on your Ubuntu machine.

Conclusion

You can install PostgreSQL 16.0 on Ubuntu 22.04 with simple commands. Before you proceed with the installation, add the PostgreSQL repository, and then install the package using “sudo apt install postgresql”. This post guided you on the installation of the newest version of PostgreSQL on your Ubuntu 22.04 system.

Leave feedback about this

  • Quality
  • Price
  • Service

PROS

+
Add Field

CONS

+
Add Field
Choose Image
Choose Video