Install PostgreSQL

RHEL 10 provides PostgreSQL 16 as the initial version of the Application Stream, which you can install as an RPM package. In minor releases, RHEL 10 provides additional PostgreSQL versions as alternative versions with a shorter life cycle.

About this task

In RHEL 10, the PostgreSQL server is available in the following versions:

  • PostgreSQL 16
  • PostgreSQL 18 available since RHEL 10.2
Important

By design, you can install only one version (stream) of the same application stream and, because of conflicting RPM packages, you cannot install multiple PostgreSQL instances on the same host. As an alternative, you can run the database server services in a container. See Using containers to run multiple PostgreSQL instances on a single host.

Procedure

  1. Install the PostgreSQL server packages:
    • For PostgreSQL 16, enter:
      # dnf install postgresql-server
    • For PostgreSQL 18, enter:
      # dnf install postgresql18-server

    The postgres superuser is created automatically.

  2. Initialize the database cluster:
    # postgresql-setup --initdb

    Store the data in the default /var/lib/pgsql/data directory.

  3. Enable and start the postgresql service:
    # systemctl enable --now postgresql.service