4.2. Installing PostgreSQL
RHEL 9 provides PostgreSQL 13 as the initial version of this Application Stream, which you can install easily as an RPM package.
Additional PostgreSQL versions are provided as modules with a shorter life cycle in minor releases of RHEL 9. RHEL 9.2 introduced PostgreSQL 15 as the postgresql:15
module stream.
To install PostgreSQL, use the following procedure.
Procédure
Install the PostgreSQL server packages:
For PostgreSQL 13 from the RPM package:
# dnf install postgresql-server
For PostgreSQL 15 by selecting stream (version) 15 from the
postgresql
module and specifying theserver
profile:# dnf module install postgresql:15/server
The
postgres
superuser is created automatically.
Initialize the database cluster:
# postgresql-setup --initdb
Red Hat recommends storing the data in the default
/var/lib/pgsql/data
directory.Start the
postgresql
service:# systemctl start postgresql.service
Enable the
postgresql
service to start at boot:# systemctl enable postgresql.service