PostgreSQL15 on CentOS 7
Install and configure PostgreSQL 15 on CentOS 7 for optimal performance.
PostgreSQL is a powerful, open-source object-relational database system with over 30 years of active development that has earned it a strong reputation for reliability, feature robustness, and performance and is supported by a number of different programming languages. It is often used as a backend for web applications and has a strong reputation for reliability, data integrity, and correctness.
In order to install Postgresql, we need to visit the official website of PostgreSQL
Navigate to Download Menu
Select your operating system family as LINUX
Select your Linux distribution as REDHAT
You will get the form to select the version, select the latest version as 15, and Select platform: CENTOS 7
You will the steps to Install the Postgresql
# Install the repository RPM:
sudo yum install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm
# Install PostgreSQL:
sudo yum install -y postgresql15-server
# Optionally initialize the database and enable automatic start:
sudo /usr/pgsql-15/bin/postgresql-15-setup initdb
sudo systemctl enable postgresql-15
sudo systemctl start postgresql-15
Copy the first to install the repository RPM and run it in the terminal
yum install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm
Now Copy the second step to Install PostgreSQL
yum install -y postgresql15-server
Here we need to install the dependent package first libzstd.so
Search on pkgs.org for this rpm and delete the Linux 7 and copy the Binary Package link
Now, install using YUM
yum install -y https://download-ib01.fedoraproject.org/pub/epel/7/x86_64/Packages/l/libzstd-1.5.2-1.el7.x86_64.rpm
Now, try again to run the second step
yum install -y postgresql15-server
Now, after installation, we will initialize the database and enable automatic start:
/usr/pgsql-15/bin/postgresql-15-setup initdb
systemctl enable postgresql-15
systemctl start postgresql-15
and after that, we'll check for the process using
ps -ef | grep postgres
As we can see that our Postgres service is running using Postgres user
Let's login to the Postgres user and login to the psql
su - postgres
psql
let's check for the database
\l
We can see that 2 templates and 1 sample Postgres database in the list. Thank you ..!