here are the packages: https://download.postgresql.org/pub/repos/yum/

# updated: 2021-01

# the guide below is probably outdated
# the official current howto https://www.postgresql.org/download/linux/redhat/
# tries to install postgres13 like this:

# Install the repository RPM:
dnf install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm

# Disable the built-in PostgreSQL module:
dnf -qy module disable postgresql

# Install PostgreSQL:
dnf install -y postgresql13-server

# Optionally initialize the database and enable automatic start:
/usr/pgsql-13/bin/postgresql-13-setup initdb
systemctl enable postgresql-13
systemctl start postgresql-13

# tested on
hostnamectl 
       CPE OS Name: cpe:/o:centos:centos:8
            Kernel: Linux 4.18.0-147.3.1.el8_1.x86_64
      Architecture: x86-64

# one could do just this:
# yum install postgresql-server postgresql-contrib
# will give one this version:
# psql --version
# psql (PostgreSQL) 10.6

# if one wants v12

dnf -y install https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm

dnf -qy module disable postgresql

dnf -y install epel-release
dnf -y config-manager --set-enabled PowerTools
dnf -y install postgis30_12

yum -y install postgresql12-server postgresql12-contrib

/usr/pgsql-12/bin/postgresql-12-setup initdb

psql --version
psql (PostgreSQL) 12.1

# view main config file
vim /var/lib/pgsql/12/data/postgresql.conf
listen_addresses = 'localhost' # what IP address(es) to listen on; 
systemctl enable --now postgresql-12

systemctl restart postgresql-12
systemctl status postgresql-12.service

# follow logs / debugging problems:
# put this
find /var/log/ -type f \( -name "*" \) ! -path '*.gz*' -exec tail -n0 -f "$file" {} +
# in here
/scripts/mon_all_logs.sh

# and this
find /opt/tomcat/ -type f \( -name "*" \) ! -path '*.gz*' -exec tail -n0 -f "$file" {} +
# in that
/scripts/mon_all_tomcat_logs.sh

chmod + /scripts/*.sh

# increase limit of maximum per user open files
ulimit -n 8192;

# run the debugging
/scripts/mon_all_logs.sh &
/scripts/mon_all_tomcat_logs.sh &

# Error creating bean with name entityManagerFactory defined in class path resource spring bootstrap.xml
# Invocation of init method failed nested exception is 
# Could not open JDBC Connection for transaction nested exception is java.sql.SQLException
# Connections could not be acquired from the underlying database!

# and:

# psql: error: could not connect to server: FATAL:  Ident authentication failed for user 
vim /var/lib/pgsql/12/data/pg_hba.conf

# change those fields to md5

# TYPE  DATABASE        USER            ADDRESS                 METHOD

# "local" is for Unix domain socket connections only
local   all             all                                     md5
# IPv4 local connections:
host    all             all             127.0.0.1/32            md5
# IPv6 local connections:
host    all             all             ::1/128                 md5

# restart postgres and watch the logs
systemctl restart postgresql-12.service

# test connect to testdb as user username
psql -d testdb -U username
# prompt for password
Password for user username:
# should appear


liked this article?

  • only together we can create a truly free world
  • plz support dwaves to keep it up & running!
  • (yes the info on the internet is (mostly) free but beer is still not free (still have to work on that))
  • really really hate advertisement
  • contribute: whenever a solution was found, blog about it for others to find!
  • talk about, recommend & link to this blog and articles
  • thanks to all who contribute!
admin