How to install PostgreSQL 14 and pgAdmin4 in CentOS 7

How to install PostgreSQL 14 and pgAdmin4 in CentOS 7

PostgreSQL is a sophisticated, widely-used, open-source, multi-platform, and advanced object-relational database system that is well-known for its proven architecture, data integrity, robust feature set, and extensibility.

pgAdmin is a web-based administration and management tool for the PostgreSQL database server that is advanced, open-source, and full-featured.

This article will show you how to install the PostgreSQL 12 database server as well as pgAdmin 4 in the CentOS 8 Linux platform.

Installation Steps

Activate the official Yum Repository for PostgreSQL

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

Install both the server and client packages for PostgreSQL 14.

$ yum install -y postgresql14-server

After the installation is complete, start the PostgreSQL-12 service and set it to run automatically at system startup. Then verify that the service is up and operating, as well as enabled as indicated.

$ /usr/pgsql-14/bin/postgresql-14-setup initdb

Enable PostgreSQL

$ systemctl enable postgresql-14

Start PostgreSQL

$ systemctl start postgresql-14

Check Status PostgreSQL

$ systemctl status postgresql-14
0013

Then, for the PostgreSQL administrator database user/role, switch to the Postgres system account and generate a secure and strong password as follows.

Create roles for FreeSWITCH

$ su postgres -

bash-4.2$ psql

postgres=# create role fsbkp with password 'fsbkp!' login;
CREATE ROLE
postgres=# create role shah with password 'shah' login superuser createdb;
CREATE ROLE
postgres=# \q
bash-4.2$ exit
exit

Create a database (for FreeSWITCH)

$ su postgres -

bash-4.2$ psql
postgres=# create database freeswitch owner freeswitch;
CREATE DATABASE
postgres=# \q
bash-4.2$ exit
exit

su postgres

Configure the Postgres server’s authentication for clients like pgAdmin. Password-based authentication is supported, and it employs one of the following methods: md5, crypt, or password.

Open `/var/lib/pgsql/14/data/pg_hba.conf` in your favorite editor and add the line

# IPv4 local connections:
host    all             all             10.10.110.45/24         md5
0016

Open `/var/lib/pgsql/14/data/postgresql.conf` in your favorite editor and `uncomment` the line and replace localhost with `’*’`

listen_addresses = '*'
0014

Restart PostgreSQL

$ systemctl restart postgresql-14

Installation of pgAdmin4

To manage the PostgreSQL database from the web, we’ll install pgAdmin 4. The EPEL and pgAdmin Yum repositories, which include some of the dependencies, must first be enabled.

$ rpm -i https://ftp.postgresql.org/pub/pgadmin/pgadmin4/yum/pgadmin4-redhat-repo-2-1.noarch.rpm
dependancies

Use the commands below to install pgAdmin.

$ yum install -y pgadmin4

The pgadmin4 package includes a script for configuring the pgAdmin web service, which will create a user account for web authentication, configure SELinux policies, and deploy the pgAdmin web service using Apache.

$ /usr/pgadmin4/bin/setup-web.sh
initialize db and enable

Start the httpd service and set it to start automatically when the system boots up, then verify that it is up and operating as described.

$ systemctl start httpd.service
$ systemctl enable httpd.service

Change ownership and context

$ chown -R apache:apache /var/lib/pgadmin/*
$ chown -R apache:apache /var/log/pgadmin/*
$ chcon -t httpd_sys_rw_content_t /var/lib/pgadmin -R
$ chcon -t httpd_sys_rw_content_t /var/log/pgadmin –R

Open a browser and go to the following URL to get to the pgAdmin online interface. Use the email address and password you created when the login interface loads.

pgadmin4

Follow us TwitterFacebookLinkedIn

Open Source Listing

Previous Post
Next Post

Comments

Top 10 Open Source Database Softwares - Open Source Listing

[…] by the PostgreSQL Global Development Group and released under a liberal open-source license. PostgreSQL is a popular choice for enterprise-level applications and is known for its ability to handle large […]

How to Setup PostgreSQL Replication - Open Source Listing

[…] of the key features of PostgreSQL is its ability to handle large amounts of data while maintaining consistency and reliability. It […]

Leave a Reply