Installing PostgreSQL 15

PostgreSQL 15 is one of the most popular open-source relational database systems. It is possible to install it both online (using internet-based package repositories) and offline (manual or air-gapped) installation methods. This steps below will guide you through Postgres 15 installation on Enterprise Linux 9.

Internet-based installation

  1. Add PostgreSQL yum repository with the following commands.
sudo dnf install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-9-x86_64/pgdg-redhat-repo-latest.noarch.rpm
  1. Disable built-in PostgreSQL module as follows.
sudo dnf -qy module disable postgresql
  1. Install PostgreSQL 15 server.
sudo dnf install -y postgresql15-server
  1. Initialize database cluster.
sudo /usr/pgsql-15/bin/postgresql-15-setup initdb
  1. Enable and start PostgreSQL service.
sudo systemctl enable --now postgresql-15
systemctl status postgresql-15
  1. Configure database and roles.
sudo su - postgres
chown postgres:postgres /tmp/setup.sql
psql -f /tmp/setup.sql
Note: Provide all contents in setup.sql from initialization AQL script of OpenIAM and Activiti database to create necessary schema and users.

Next, update role settings

psql -d openiam -c "ALTER ROLE idmuser SET search_path TO public; GRANT USAGE ON SCHEMA public TO idmuser; GRANT CREATE ON SCHEMA public TO idmuser;"
psql -d activiti -c "ALTER ROLE activiti SET search_path TO public; GRANT USAGE ON SCHEMA public TO activiti; GRANT CREATE ON SCHEMA public TO activiti;
  1. Verify service status.
systemctl status postgresql-15.service

Non-internet-based installation

Non-internet-based installation is similar to that of internet-based except the packages need to be downloaded manually.

  1. Download offline package at https://download.openiam.com/release/enterprise/infra/postgres-15.tar.gz
  2. Install PostgreSQL packages with the following command.
sudo dnf install -y --disablerepo="*" *.rpm --skip-broken
  1. Initialize database cluster.
sudo /usr/pgsql-15/bin/postgresql-15-setup initdb
  1. Enable and start PostgreSQL service.
sudo systemctl enable --now postgresql-15
systemctl status postgresql-15
  1. Configure database and roles
sudo su - postgres
chown postgres:postgres /tmp/setup.sql
psql -f /tmp/setup.sql
Note: Provide all contents in setup.sql from initialization AQL script of OpenIAM and Activiti database to create necessary schema and users.

Next, update role settings.

psql -d openiam -c "ALTER ROLE idmuser SET search_path TO public; GRANT USAGE ON SCHEMA public TO idmuser; GRANT CREATE ON SCHEMA public TO idmuser;"
psql -d activiti -c "ALTER ROLE activiti SET search_path TO public; GRANT USAGE ON SCHEMA public TO activiti; GRANT CREATE ON SCHEMA public TO activiti;
  1. Verify service status with the following command.
systemctl status postgresql-15.service

Connecting to locally installed PostgreSQL

First, access PostgreSQL CLI with

sudo su - postgres
psql

... and list all databases as follows.

\l