.Install language packs and set language
[source,console]
----
sudo dnf install langpacks-en glibc-all-langpacks -y
sudo localectl set-locale LANG=en_US.UTF-8
sudo localectl
sudo dnf makecache
sudo dnf update -y
----

.Install PostgreSQL
[source, console]
[subs="verbatim,attributes"]
----
sudo dnf install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-9-x86_64/pgdg-redhat-repo-latest.noarch.rpm
sudo dnf -qy module disable postgresql
sudo dnf install -y postgresql{postgresql-version}-server
sudo /usr/pgsql-{postgresql-version}/bin/postgresql-{postgresql-version}-setup initdb
sudo systemctl enable postgresql-{postgresql-version}
sudo systemctl start postgresql-{postgresql-version}
----

IMPORTANT: You must provide a secure password for the `opennms` database user account.
This guide uses `YOUR-OPENNMS-PASSWORD` as a placeholder.

.Create an opennms database user and password
[source, console]
sudo -i -u postgres createuser -P opennms

.Create an empty database and set the owner to the opennms user
[source, console]
sudo -i -u postgres createdb -O opennms opennms

IMPORTANT: Change `YOUR-POSTGRES-PASSWORD` to a secure one and use the prefixed space to avoid storing the password in the history.
The superuser is required to be able to initialize and change the database schema for installation and updates.

.Set a password for PostgreSQL superuser
[source, console]
----
sudo -i -u postgres psql -c "ALTER USER postgres WITH PASSWORD 'YOUR-POSTGRES-PASSWORD';"
----
