Get 50% Discount Offer 7 Days


Contact Info

Chicago 12, Melborne City, USA

+88 01682648101

[email protected]

Recommended Services
Supported Scripts
How to Setup PostgreSQL 15 on AlmaLinux

You have probably already heard about the Postgresql database system. This open-source database is very popular and has been around for over 30 years. This system provides proper support of SQL language which is used for database management and other operations like crud. PostgreSQL’s reputation is due to its robustness, high performance, and flexibility. This basic storage system is suitable for many web applications. Some of these global giants that rely on Postgresql include Trivago, Instagram, Spotify, Netflix, etc. This article is a complete guide to show how to setup PostgreSQL 15 on AlmaLinux.

Definition of PostgreSQL Database

As mentioned earlier, PostgreSQL, often referred to simply as “Postgres”, is a powerful open-source relational database management system (RDBMS). This language is known for its extensibility, reliability, and adherence to SQL (Structured Query Language) standards. PostgreSQL is designed to efficiently store and manage large volumes of structured data while providing advanced features and functionality. This database system supports both SQL (relational) and JSON (non-relational) querying. It is highly stable. At first, PostgreSQL was designed to run on Unix But, then it evolved to run on different platforms like Windows, MAC, or Solaris.

Definition of PostgreSQL Database

What Are Important Features of PostgreSQL?

PostgreSQL (often referred to as Postgres) is a powerful database management system that contains important and effective features and capabilities. Some of its important features include:

  • Table inheritance option
  • It is equipped with a Sophisticated locking mechanism
  • Foreign key referential integrity
  • User-defined types
  • Asynchronous replication option
  • Multi-version concurrency control (MVCC)
  • Nested transactions (savepoints)
  • It contains Views, rules, subquery

The following features are added to the recent versions of PostgreSQL:

  • Tablespace
  • Native Microsoft Windows Server version
  • Point-in-time recovery

How to Setup PostgreSQL 15 on AlmaLinux

In this section, we will introduce of some steps to setup a PostgreSQL 15 database on AlmaLinux, For this reason, you will need a Linux VPS. Now follow the instructions:

Setup PostgreSQL 15 on AlmaLinux

Adding PostgreSQL Repository

Note that the default version of Postgres is on Appstream repositories of PostgreSQL 10.

sudo dnf module list PostgreSQL

Tip: To install the latest version you should install the PostgreSQL yum repository on your system.

--------------- AlmaLinux 9 ---------------
sudo dnf install
--------------- AlmaLinux 8 ---------------
sudo dnf install -y

Installing PostgreSQL 15 on AlmaLinux

Now you can use the Yum repository when needed. The next action will be updating repositories. So use the following command for this reason:

sudo dnf update -y

You should disable the default module which here is PostgreSQL 15:

sudo dnf -qy module disable PostgreSQL

Now you can use the command below to proceed and install the PostgreSQL 15 client and server:

sudo dnf install -y postgresql15-server

You can insert Y and click on Enter, every time you are asked to import the GPG key.

This command will install PostgreSQL and other dependencies.

Use the following command to confirm the version of PostgreSQL:

psql -V
psql (PostgreSQL) 15.0

Initializing the PostgreSQL database

Before proceeding with the rest of the operation, we need to initialize the initdb database, because this database is responsible for creating the new PostgreSQL cluster. For initializing the database act as follows:

sudo /usr/pgsql-15/bin/postgresql-15-setup initdb

Starting and Enabling PostgreSQL Service

As you finish the installation process it is time to start the PostgreSQL service and ensure your database server is running:

You should start the PostgreSQL database server:

sudo systemctl start postgresql-15

Now you can enable the PostgreSQL server using the following command:

sudo systemctl enable postgresql-15

Use the following command to confirm that PostgreSQL is up and running:

sudo systemctl status postgresql-15 

Connecting to the PostgreSQL Database

After you install PostgreSQL, a default database user named Postgres is created that does not require authentication or a password. So, in the next steps, due to security reasons, we have to create a day password. So let’s log in to the PostgreSQL shell by switching to the Postgres user:

sudo su -postgres

Now you should have access to the database prompt by running this command:


Setting Password to the Postgres User

As the final step, you should secure the user by setting a password for your security, so run the command below:

sudo passwd postgres

Now determine a new password and confirm. Then log in to PostgreSQL as a Postgres user:

are - postgres

Then use this command:

psql -c "ALTER USER postgres WITH PASSWORD 'your-password';"

The next time you want to log in to the database, you will be asked to authenticate:

su - postgres


Installing PostgreSQL on AlmaLinux is not that much difficult. As you can see, we tried to show you a step-by-step guide to help you do this task. Postgres is an advanced database that is the primary data store for mobiles and web applications, and already reached version 15.2 which was out on February 9th, 2023. Also, you thought about How to enable and connect to this database. Note that you can run PostgreSQL on any other operating system like Windows and Mac. You can share your ideas or questions related to this post with a comment.

Rate this post
Share this Post

Leave a Reply

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