Skip to content

Latest commit

 

History

History
65 lines (52 loc) · 2.07 KB

postgresql.adoc

File metadata and controls

65 lines (52 loc) · 2.07 KB
Install language packs and set language
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
sudo reboot
sudo dnf info postgresql-server
Note
These procedures use a specific PostgreSQL version. Make sure you reference your current PostgreSQL version.
Install PostgreSQL client and server
sudo dnf -y install https://download.postgresql.org/pub/repos/yum/reporpms/EL-9-x86_64/pgdg-redhat-repo-latest.noarch.rpm
sudo dnf -y install postgresql14-server
Initialize the PostgreSQL database
sudo /usr/pgsql-14/bin/postgresql-14-setup initdb
Enable PostgreSQL on system boot and start immediately
sudo systemctl enable --now postgresql-14
Create an opennms database user and password
sudo -i -u postgres createuser -P opennms
Important
You must provide a secure password for the opennms database user account. This guide uses YOUR-OPENNMS-PASSWORD as a placeholder.
Create an empty database and set the owner to the opennms user
sudo -i -u postgres createdb -O opennms opennms
Set a password for PostgreSQL superuser
sudo -i -u postgres psql -c "ALTER USER postgres WITH PASSWORD 'YOUR-POSTGRES-PASSWORD';"
Important
Change YOUR-POSTGRES-PASSWORD to a secure one. The superuser is required to be able to initialize and change the database schema for installation and updates.
Change the access policy for PostgreSQL
sudo vi /var/lib/pgsql/14/data/pg_hba.conf
Allow {page-component-title} to access the database over the local network with an MD5 hashed password
host    all             all             127.0.0.1/32            md5 (1)
host    all             all             ::1/128                 md5 (1)
  1. Change method from ident to md5 for IPv4 and IPv6 on localhost.

Apply configuration changes for PostgreSQL
sudo systemctl reload postgresql-14