Home » Centos/RHEL » Install Postgresql Database Centos7/RHEL7

Install Postgresql Database Centos7/RHEL7

This article is related to Install Postgresql Database Centos7/RHEL7.
PostgreSQL could be a powerful, open supply object-relational info system that uses and extends the SQL language combined with several options that safely store and scale the foremost sophisticated knowledge workloads. The origins of PostgreSQL originate to 1986 as a part of the POSTGRES project at the University of California at Berkeley and has quite thirty years of active development on the core platform.

PostgreSQL has attained a robust name for its proved design, responsibility, knowledge integrity, strong feature set, extensibility, and also the dedication of the open supply community behind the software system to systematically deliver performant and innovative solutions. PostgreSQL runs on all major in operation systems, has been ACID-compliant since 2001, and has powerful add-ons like the favored PostGIS geospatial info extender. it’s no surprise that PostgreSQL has become the open supply electronic information service of alternative for several folks and organisations. In this article we will show how to install Postgresql database Centos7/RHEL7

Enable PostgreSQL Yum Repository

If you require to install postgresql 12 on Centos7/RHEL7 then install below repos RPMS


If you require to install postgresql 10 on Centos7/RHEL7 then install below repos RPMS


To install postgresql10 on Centos6/RHEL6 install download following yum repo RPM Package.
CentOS/RHEL – 6

[root@server ~]#rpm -Uvh https://yum.postgresql.org/10/redhat/rhel-6-x86_64/pgdg-redhat10-10-2.noarch.rpm

In This article we are going to Install Posgresql 10 Database on Centos7

[root@server ~]#rpm -Uvh https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-7-x86_64/pgdg-centos10-10-2.noarch.rpm
[root@server ~]#yum install postgresql10-server postgresql10

Initialize PGDATA
After installing PostgreSQL server, We have to required initialize database before using the first time. To initialize database use below command.

[root@server ~]#/usr/pgsql-10/bin/postgresql-10-setup initdb

Now time to Start PostgreSQL Server
To start PostgreSQL service daemon by using the following command and Also, enable PostgreSQL daemon to autostart on system boot.
For CentOS/RHEL 7 and Fedora

[root@server ~]#systemctl start postgresql-10.service
[root@server ~]#systemctl enable postgresql-10.service

For CentOS/RHEL 6

[root@server ~]#service postgresql-10 start
[root@server ~]#chkconfig postgresql-10 on

Finally verify postgresql database installation

[root@server ~]# su – postgres -c “psql”
psql (10.6)
Type “help” for help.
postgres=# \l
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
postgres | postgres | UTF8 | en_US.UTF8 | en_US.UTF8 |
template0 | postgres | SQL_ASCII | C | C | =c/postgres +
| | | | | postgres=CTc/postgres
template1 | postgres | SQL_ASCII | C | C | =c/postgres +
| | | | | postgres=CTc/postgres
testlive | postgres | UTF8 | en_US.utf8 | en_US.utf8 |
(4 rows)
postgres=# \q

To take backup of postgresql database

[root@server ~]#pg_dump -U postgres -d TestLive > testlive.pgsql

To restore backup of postgresql database

[root@server ~]#pg_dump -U postgres -d testlive > testlive.pgsql

You have completed successfully the PostgreSql database instalaltion on Centos 7/RHEL7

Install phpPgAdmin using yum


I am founder and webmaster of www.linuxpcfix.com and working as a Sr. Linux Administrator (Expertise on Linux/Unix & Cloud Server) and have been in the industry since more than 14 years.

One thought on “Install Postgresql Database Centos7/RHEL7

Leave a Reply

Your email address will not be published. Required fields are marked *


Time limit is exhausted. Please reload the CAPTCHA.

Categorized Tag Cloud