Installing PostgreSQL on Ubuntu 24.04

In this article, we cover how to install PostgreSQL on the Ubuntu 24.04 release. PostgreSQL is a free and open-source RDBMS. A relational database management system (RDBMS) helps us gain insights about the relationship between different data points.

Why choose PostgreSQL?

  1. ACID-Compliant database,
  2. Open source,
  3. Resilient performance.

Note:Ā The following operations require System Administrator privileges to make changes. If you lack necessary Administrative privileges then, reach out to your System Administrator for assistance.

Installing PostgreSQL on Ubuntu 24.04

Step 1. Before we can begin with the installation part, we need to ensure that we have the latest package information in the standard Ubuntu repository. So, update the repository first. Open a terminal and issue the following command:

sudo apt update

Step 2. Install PostgreSQL

Install the following packages:

  1. postgresql and,
  2. postgresql-contrib
sudo apt install postgresql postgresql-contrib

postgres is PostgreSQL’s superuser.

Step 3. Switch user to postgres:

sudo -i -u postgres

Enter superuser password to login.

Step 4. And, to access PostgreSQL prompt:

psql

At this stage, you should see the following prompt:

postgres=#

From the prompt, we can manage databases and users. We would like to add here that, postgresĀ doesn’t have the password. It is recommended that we assign one.

In the PostgreSQL prompt:

\password postgres

Enter the password twice. Use \q to exit the PostgreSQL prompt. And, exit command to log out user postgres.

In conclusion, we have covered how to install PostgreSQL in the Ubuntu 24.04 release here. For more information, you can go through PostgreSQL Documentation.

Similar Posts