Downloading package
In the realm of Red Hat, we employ RPMs (Red Hat Package Manager) as a fundamental tool. RPM files serve as the architects of software repositories, facilitating the seamless installation of software packages. The process unfolds as follows:
- 
Selecting the Operating System (OS) Version: This step is akin to choosing the foundation upon which our digital infrastructure will be built.
 - 
Utilizing the Yum Repository Method: We opt for the Yum repository method, a robust approach akin to gaining access to a comprehensive software library.
 - 
PostgreSQL Version Selection: A pivotal decision arises as we must specify the PostgreSQL version. For our purposes, let’s opt for PostgreSQL version 12.
use the below commandwgetto download file directory from websitewget [link to download ]wget [https://yum.postgresql.org/packages/#pg12]
or use the below script which you can get from website its self 
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 postgresql12-server sudo /usr/pgsql-12/bin/postgresql-12-setup initdb sudo systemctl enable postgresql-12 sudo systemctl start postgresql-12
- 
on the script you will download rpm repo package
 - 
disable the PostgreSQL module available on redhat (only redhat)
 - 
sudo dnf -qy module disable postgresqlThis command ensures that the PostgreSQL module will not be active or installed on the system. It can be useful when you want to prevent the installation or use of a specific PostgreSQL module or version - 
/usr/pgsql-12/bin/postgresql-12-setup: This part of the command specifies the path to the PostgreSQL version 12 setup utility. It’s a script or program responsible for configuring and managing various aspects of PostgreSQL, including initializing the database cluster. - 
initdb: The"initdb"command is short for “initialize database.” When executed, it creates a new PostgreSQL database cluster, which is the core directory structure and configuration files required to run a PostgreSQL instance. It sets up the essential components and directory structure for a fresh database installation.
In summary, the provided command, “sudo /usr/pgsql-12/bin/postgresql - 
setup initdb,” is used to initialize a PostgreSQL version 12 database cluster on the system with elevated privileges, creating the necessary infrastructure for PostgreSQL to operate effectively.
 
additional package we need to install postgree-contrib , this will include all additional features
to locate this the syntax for package use yum list  postgresql12*
configuring PostgreSQL post installation
During the installation of PostgreSQL on a Linux system, you may have noticed that the installation process lacks certain user interactions that are typically associated with software installations. Unlike some other software, PostgreSQL installation on Linux doesn’t ask you for important details such as the data directory, installation directory, port number, or even the PostgreSQL password.
installation and data directory in Linux
the installation directory will be in usr/pgsql-12/bin/ 
the data directory will be locating in /var/lib/pgsql/ 
create superuser for PostgreSQL
to check the superuser for PostgreSQL is configured
type su - postgres
if it dint ask you for password means the password was not setup for PostgreSQL
you cannot login to PostgreSQL using normal only root can access
then once you login just Chang the password using passwd command using the root user
make sure the services are running
make sure the below command is installed
sudo systemctl enable postgresql-12 sudo systemctl start postgresql-12
setup environment variables
first login using postgres user
the use VIM to edit the
the installer has already specify the pgdata path for the user
you just need to specify the path for binary to be used by userPATH=$PATH:HOME/BIN export PATH export PATH=/usr/pgsql-12/bin:$PATH
when you want to use deterrent user then you will have to edit environment path for that user to .
