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
- 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
- Disable built-in PostgreSQL module as follows.
sudo dnf -qy module disable postgresql
- Install PostgreSQL 15 server.
sudo dnf install -y postgresql15-server
- Initialize database cluster.
sudo /usr/pgsql-15/bin/postgresql-15-setup initdb
- Enable and start PostgreSQL service.
sudo systemctl enable --now postgresql-15systemctl status postgresql-15
- Configure database and roles.
sudo su - postgreschown postgres:postgres /tmp/setup.sqlpsql -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;
- 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.
- Download offline package at https://download.openiam.com/release/enterprise/infra/postgres-15.tar.gz
- Install PostgreSQL packages with the following command.
sudo dnf install -y --disablerepo="*" *.rpm --skip-broken
- Initialize database cluster.
sudo /usr/pgsql-15/bin/postgresql-15-setup initdb
- Enable and start PostgreSQL service.
sudo systemctl enable --now postgresql-15systemctl status postgresql-15
- Configure database and roles
sudo su - postgreschown postgres:postgres /tmp/setup.sqlpsql -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;
- Verify service status with the following command.
systemctl status postgresql-15.service
Connecting to locally installed PostgreSQL
First, access PostgreSQL CLI with
sudo su - postgrespsql
... and list all databases as follows.
\l