Postgresql Database v15 Installation Steps in Centos 8 OS-Step-By-Step Guide


Below are the Steps By Steps Guide to install PostgreSQL v 15 database on CentOS 8.


Step 1: 

After installing the CentOS 8, first step is to update System Packages before installing PostgreSQL, it's a best to ensure your system's packages are up-to-date. Open a terminal or SSH into your CentOS server and run the following commands:

cd /etc/yum.repos.d/

 sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*

 sed –I 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*

 sudo yum update

 
Step 2: 
Next step is to install the repository RPM, from where the postgresql will be downloaded and install on your system. 
sudo yum install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm


Step 3: 


In this steps you disable the postgresql stream module in AppStream, unblocking the postgres packages in the pgdg repos:

 

dnf module disable postgresql
 

Step 4: 
In this steps you install PostgreSQL database using below command.
sudo yum install -y postgresql15-server
 


Step 5: 
Initialize the Database
 
sudo /usr/pgsql-15/bin/postgresql-15-setup initdb
 


Step 6: 
Start and Enable PostgreSQL 

Start the PostgreSQL service and enable it to start automatically on boot.
sudo systemctl start postgresql-15.service
sudo systemctl enable postgresql-15.service

 

Step 7: 

Configure PostgreSQL configuration file.

The main configuration file is located at: /var/lib/pgsql/data/postgresql.conf

Edit this file using and make necessary changes.

For example

To allow remote connections, find the line that says listen_addresses = 'localhost' and change it to listen_addresses = '*'. This will allow PostgreSQL to listen on all available network interfaces.



 

No comments

Powered by Blogger.