Install PostgreSQL

This page describes how to install PostgreSQL on RedHat Enterprise Linux or derivatives.

Step 1: Install PostgreSQL 16

Install the PostgreSQL 16 package included in RHEL. More info in the ‘Included in Distribution’ section of the postgresql documentation.

sudo dnf module install postgresql:16/server
sudo systemctl enable postgresql

Warning

Before moving on to the next step, make sure that the locale used by the system is actually installed. By default, RHEL9 uses the en_US.UTF-8 locale which can be installed via:

sudo dnf install langpacks-en -y

Note

If your system uses a different locale, please install the corresponding langpack.

sudo dnf module install postgresql:16/server
sudo systemctl enable postgresql

Step 2: Setup a PostgreSQL database for the Inmanta server

Initialize the PostgreSQL server:

sudo su - postgres -c "postgresql-setup --initdb"

Start the PostgreSQL database and make sure it is started at boot.

sudo systemctl enable --now postgresql

Create an inmanta user and an inmanta database by executing the following command. This command will request you to choose a password for the inmanta database.

sudo -u postgres -i bash -c "createuser --pwprompt inmanta"
sudo -u postgres -i bash -c "createdb -O inmanta inmanta"

Change the authentication method for local connections to md5 by changing the following lines in the /var/lib/pgsql/data/pg_hba.conf file.

# IPv4 local connections:
host    all             all             127.0.0.1/32            ident
# IPv6 local connections:
host    all             all             ::1/128                 ident

to

# IPv4 local connections:
host    all             all             127.0.0.1/32            md5
# IPv6 local connections:
host    all             all             ::1/128                 md5

This will make sure you can authenticate using username and password from localhost. If you need password authentication from a different interface, change the 127.0.0.1 and ::1/128 values in the example to the correct interfaces.

Make sure JIT is disabled for the PostgreSQL database as it might result in poor query performance. To disable JIT, set

# disable JIT
jit = off

in /var/lib/pgsql/data/postgresql.conf.

Restart the PostgreSQL server to apply the changes made in the pg_hba.conf and postgresql.conf files:

sudo systemctl restart postgresql