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
# dnf install postgresql-server
Copy to Clipboard Copied! Toggle word wrap Toggle overflow For PostgreSQL 15 by selecting stream (version) 15 from the
postgresql
module and specifying theserver
profile:dnf module install postgresql:15/server
# dnf module install postgresql:15/server
Copy to Clipboard Copied! Toggle word wrap Toggle overflow The
postgres
superuser is created automatically.
Initialize the database cluster:
postgresql-setup --initdb
# postgresql-setup --initdb
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Red Hat recommends storing the data in the default
/var/lib/pgsql/data
directory.Start the
postgresql
service:systemctl start postgresql.service
# systemctl start postgresql.service
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Enable the
postgresql
service to start at boot:systemctl enable postgresql.service
# systemctl enable postgresql.service
Copy to Clipboard Copied! Toggle word wrap Toggle overflow