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
![](https://static.wixstatic.com/media/cb6190_2e7d981671b342cfbf30169ec8cde2e7~mv2.png/v1/fill/w_49,h_20,al_c,q_85,usm_0.66_1.00_0.01,blur_2,enc_auto/cb6190_2e7d981671b342cfbf30169ec8cde2e7~mv2.png)
Navigate to Download Menu
![](https://static.wixstatic.com/media/cb6190_ec442173b345425294f72e5edc9c6126~mv2.png/v1/fill/w_49,h_20,al_c,q_85,usm_0.66_1.00_0.01,blur_2,enc_auto/cb6190_ec442173b345425294f72e5edc9c6126~mv2.png)
Select your operating system family as LINUX
![](https://static.wixstatic.com/media/cb6190_b90037efe979498c8acabb6716df7790~mv2.png/v1/fill/w_49,h_20,al_c,q_85,usm_0.66_1.00_0.01,blur_2,enc_auto/cb6190_b90037efe979498c8acabb6716df7790~mv2.png)
Select your Linux distribution as REDHAT
![](https://static.wixstatic.com/media/cb6190_bc01029505b7424e8d1b6c31607cf913~mv2.png/v1/fill/w_49,h_20,al_c,q_85,usm_0.66_1.00_0.01,blur_2,enc_auto/cb6190_bc01029505b7424e8d1b6c31607cf913~mv2.png)
You will get the form to select the version, select the latest version as 15, and Select platform: CENTOS 7
![](https://static.wixstatic.com/media/cb6190_646832cb263d4cbdbf8340232af7212a~mv2.png/v1/fill/w_49,h_20,al_c,q_85,usm_0.66_1.00_0.01,blur_2,enc_auto/cb6190_646832cb263d4cbdbf8340232af7212a~mv2.png)
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
![](https://static.wixstatic.com/media/cb6190_144567fbd78141b3b37eeab711bfa0bb~mv2.png/v1/fill/w_49,h_30,al_c,q_85,usm_0.66_1.00_0.01,blur_2,enc_auto/cb6190_144567fbd78141b3b37eeab711bfa0bb~mv2.png)
Now Copy the second step to Install PostgreSQL
yum install -y postgresql15-server
![](https://static.wixstatic.com/media/cb6190_9f3e35b393a94a66b0dd6a3ae3638b62~mv2.png/v1/fill/w_49,h_17,al_c,q_85,usm_0.66_1.00_0.01,blur_2,enc_auto/cb6190_9f3e35b393a94a66b0dd6a3ae3638b62~mv2.png)
Here we need to install the dependent package first libzstd.so
![](https://static.wixstatic.com/media/cb6190_422fa0df0773466cb5c50501693bda87~mv2.png/v1/fill/w_49,h_30,al_c,q_85,usm_0.66_1.00_0.01,blur_2,enc_auto/cb6190_422fa0df0773466cb5c50501693bda87~mv2.png)
Search on pkgs.org for this rpm and delete the Linux 7 and copy the Binary Package link
![](https://static.wixstatic.com/media/cb6190_ea4db6c1b8464db4bd456e896f1050e3~mv2.png/v1/fill/w_49,h_30,al_c,q_85,usm_0.66_1.00_0.01,blur_2,enc_auto/cb6190_ea4db6c1b8464db4bd456e896f1050e3~mv2.png)
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
![](https://static.wixstatic.com/media/cb6190_de5373f808e0426388d222b0967c9482~mv2.png/v1/fill/w_49,h_30,al_c,q_85,usm_0.66_1.00_0.01,blur_2,enc_auto/cb6190_de5373f808e0426388d222b0967c9482~mv2.png)
Now, try again to run the second step
yum install -y postgresql15-server
![](https://static.wixstatic.com/media/cb6190_b6426c4b0e9c4dd58d38d452fa9b42c5~mv2.png/v1/fill/w_49,h_30,al_c,q_85,usm_0.66_1.00_0.01,blur_2,enc_auto/cb6190_b6426c4b0e9c4dd58d38d452fa9b42c5~mv2.png)
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
![](https://static.wixstatic.com/media/cb6190_f491a3ae7b4346f3a259a071299a2da5~mv2.png/v1/fill/w_49,h_17,al_c,q_85,usm_0.66_1.00_0.01,blur_2,enc_auto/cb6190_f491a3ae7b4346f3a259a071299a2da5~mv2.png)
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
![](https://static.wixstatic.com/media/cb6190_2fa7117074aa4ce093311f7f700344bd~mv2.png/v1/fill/w_49,h_6,al_c,q_85,usm_0.66_1.00_0.01,blur_2,enc_auto/cb6190_2fa7117074aa4ce093311f7f700344bd~mv2.png)
let's check for the database
\l
![](https://static.wixstatic.com/media/cb6190_9fd91537eeea483f92991b223e9f06c5~mv2.png/v1/fill/w_49,h_8,al_c,q_85,usm_0.66_1.00_0.01,blur_2,enc_auto/cb6190_9fd91537eeea483f92991b223e9f06c5~mv2.png)
We can see that 2 templates and 1 sample Postgres database in the list. Thank you ..!