How to setup PhpPgAdmin in CentOS

PostgreSQL is an open-supply relational database control system that has helped to form the sector of software improvement with advanced, SQL-compliant. The fundamental gain of the use of PostgreSQL is that it calls for very minimal preservation efforts due to its stability. The programs primarily based totally on PostgreSQL have a low value of possession in assessment with different database control systems. It’s designed to be extensible in a manner that you could outline your very own records types, index types, functional languages, etc. PhpPgAdmin is a web-primarily based totally GUI software that makes it easy for administering your PostgreSQL databases. phpPgAdmin will allow you to add, cast off and manipulate databases, tables, and entries; run particular SQL queries, backup the database, search and import record, and lots more. In this educational we discover ways to deploy phpPgAdmin on CentOS 7.


Before beginning the set up of PotgreSQL and phpPgAdmin ensure which you have root get entry to in your CentOS server and your are linked to the internet for downloading the packages. After login in your server, run the command under to replace your centos 7 server with the state-of-the-art patches.

# yum update

If you going to install PostgreSQL and phpPgAdmin on a production surroundings with firewall and SELinux enabled, then ensure to permit the subsequent default ports in order to be used for postgreSQL and apache.

# firewall-cmd --permanent --add-port=5432/tcp
# firewall-cmd --permanent --add-port=80/tcp
# firewall-cmd --reload
# setsebool -P httpd_can_network_connect_db 1

Let’s begin the Installation

By default Centos 7 comes with PostgreSQL Version 9.2.1 that may be set up with the aid of using the usage of the easy yum command whilst the contemporary latest PostgreSQL Version is 9.4.5. So, on this tutorial, we are able to be putting in the latest model of PostgreSQL by the usage of the PostgreSQL Yum Repository. To get the latest yum repository for the latest PostgreSQL package deal open the PostgreSQL Download Page or copy the hyperlink and run the under wget command.

# wget

Now install the rpm file with below commands

# rpm -i pgdg-redhat94-9.4-1.noarch.rpm
# yum install postgresql94-server postgresql94-contrib

After jogging the above command there might be variety of the subsequent package might be established consisting of few dependencies. To continue the set up technique press the “Y” key to maintain as shown.

Dependencies Resolved
Package Arch Version Repository Size
postgresql94-contrib x86_64 9.4.5-1PGDG.rhel7 pgdg94 610 k
postgresql94-server x86_64 9.4.5-1PGDG.rhel7 pgdg94 3.8 M
Installing for dependencies:
libxslt x86_64 1.1.28-5.el7 base 242 k
postgresql94 x86_64 9.4.5-1PGDG.rhel7 pgdg94 1.0 M
postgresql94-libs x86_64 9.4.5-1PGDG.rhel7 pgdg94 209 k

Transaction Summary
Install 2 Packages (+3 Dependent packages)

Total download size: 5.9 M
Installed size: 25 M
Is this ok [y/d/N]: y

run the below command to initialize the database

# /usr/pgsql-9.4/bin/postgresql94-setup initdb
Initializing database ... OK

Start the Database service

To begin the PostgreSQL provider and to configure it for auto-permit at boot up run the subsequent commands after which test the status, it must be up and enabled.

# systemctl start postgresql-9.4
# systemctl enable postgresql-9.4

Now install the phpPgAdmin

Run the below command to install phpPgAdmin and http

yum install phpPgAdmin httpd

Type Y to install the required packages

Dependencies Resolved
Package Arch Version Repository Size
httpd x86_64 2.4.6-31.el7.centos.1 updates 2.7 M
phpPgAdmin noarch 5.1-2.rhel7 pgdg94 658 k
Installing for dependencies:
apr x86_64 1.4.8-3.el7 base 103 k
apr-util x86_64 1.5.2-6.el7 base 92 k
httpd-tools x86_64 2.4.6-31.el7.centos.1 updates 79 k
libzip x86_64 0.10.1-8.el7 base 48 k
mailcap noarch 2.1.41-2.el7 base 31 k
php x86_64 5.4.16-36.el7_1 updates 1.4 M
php-cli x86_64 5.4.16-36.el7_1 updates 2.7 M
php-common x86_64 5.4.16-36.el7_1 updates 563 k
php-pdo x86_64 5.4.16-36.el7_1 updates 97 k
php-pgsql x86_64 5.4.16-36.el7_1 updates 84 k

Transaction Summary
Install 2 Packages (+10 Dependent packages)

Total download size: 8.5 M
Installed size: 30 M
Is this ok [y/d/N]:y

Configure PhpPgAdmin

Now don’t think too much and do as I say. But be careful if you are on production server

# vim /etc/httpd/conf.d/phpPgAdmin.conf
# vim /var/lib/pgsql/9.4/data/pg_hba.conf
# vim /var/lib/pgsql/9.4/data/postgresql.conf
# vim /etc/phpPgAdmin/
// Hostname or IP address for server. Use '' for UNIX domain socket.
// use 'localhost' for TCP/IP connection on this computer
$conf['servers'][0]['host'] = 'localhost';

// Database port on server (5432 is the PostgreSQL default)
$conf['servers'][0]['port'] = 5432;

$conf['owned_only'] = true;

Now restart the both services

# systemctl restart postgresql-9.4
# systemctl restart httpd

Access the web console

Let’s open the below URL to access the phpPgAdmin console as shown below.


Now login with your DB and password…


At the stop of this text, you discovered approximately the set up and configuration of PostgreSQL with phpPgAdmin on CentOS 7. Still, this changed into step one with inside the international of PostgreSQL as there are a variety of functions upon them you need to paintings on because it has a variety of tremendous functions like factor in time recovery, tablespaces, asynchronous replication, Multi-Version Concurrency Control (MVCC), and write-in advance logging for fault tolerance. So, we are hoping you discover this text a good deal beneficial so that you can begin database management with PostgreSQL.


phppgadmin, php pg admin, phppgadmin centos, postgresql phppgadmin, postgresql, postgresql centos,