{"id":267,"date":"2015-09-07T16:10:50","date_gmt":"2015-09-07T16:10:50","guid":{"rendered":"http:\/\/onlinelab.info\/?p=267"},"modified":"2015-09-07T16:10:50","modified_gmt":"2015-09-07T16:10:50","slug":"manage-postgresql-using-phppgadmin-on-centos-7","status":"publish","type":"post","link":"https:\/\/www.asianux.org.vn\/index.php\/2015\/09\/07\/manage-postgresql-using-phppgadmin-on-centos-7\/","title":{"rendered":"Manage PostgreSQL using phpPgAdmin on CentOS 7"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-7258 size-thumbnail\" src=\"http:\/\/www.itzgeek.com\/wp-content\/uploads\/2014\/07\/phpPgAdmin-150x150.jpg\" alt=\"phpPgAdmin\" width=\"150\" height=\"150\" title=\"\">phpPgAdmin is a web based administration tool for managing PostgreSQL database, it is very similar in look of phpMyAdmin. If you have a work experience on phpMyAdmin, you wont take much time in finding the way to work with. This guide will help you to setup phpPgAdmin on CentOS 7 \/ RHEL 7.<\/p>\n<h3><strong>Installing phpPgAdmin:<\/strong><\/h3>\n<p>Before installing, take a look at <a title=\"Install PostgreSQL 9.3 on CentOS 7\" href=\"http:\/\/www.itzgeek.com\/how-tos\/linux\/centos-how-tos\/install-postgresql-9-3-on-centos-7.html\" target=\"_blank\" rel=\"nofollow noopener\">how to install PostgreSQL on CentOS 7<\/a>. If you have followed PostgrqSQL install, you do not need to steup EPEL.<\/p>\n<p>Here is the link to <a title=\"Enable EPEL Repository for CentOS 7 \/ RHEL 7\" href=\"http:\/\/www.itzgeek.com\/how-tos\/linux\/centos-how-tos\/enable-epel-repository-for-centos-7-rhel-7.html\" target=\"_blank\" rel=\"nofollow noopener\">setup EPEL repository on CentOS 7<\/a>.<\/p>\n<div class=\"wp_syntax\">\n<table>\n<tbody>\n<tr>\n<td class=\"code\">\n<pre class=\"dos\">yum -y install phpPgAdmin php-pgsql httpd php<\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<h3><strong>Configuring phpPgAdmin:<\/strong><\/h3>\n<p>Edit\u00a0 \/etc\/phpPgAdmin\/config.inc.php file, we have to modify the admin file to enable the browser access.<\/p>\n<div class=\"wp_syntax\">\n<table>\n<tbody>\n<tr>\n<td class=\"code\">\n<pre class=\"dos\">vi \/etc\/phpPgAdmin\/config.inc.php<\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>Add the localhost in the following server parameter.<\/p>\n<div class=\"wp_syntax\">\n<table>\n<tbody>\n<tr>\n<td class=\"code\">\n<pre class=\"dos\">$conf['servers'][0]['host'] = 'localhost';<\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>If extra login security is true, then logins via phpPgAdmin with no password or certain usernames (<strong>pgsql, postgres, root, administrator<\/strong>) will be denied. To enable the postgres login, change it to false.<\/p>\n<div class=\"wp_syntax\">\n<table>\n<tbody>\n<tr>\n<td class=\"code\">\n<pre class=\"dos\">$conf['extra_login_security'] = false;<\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>To simply hide other databases in the list make following condition to true \u2013 this does not in any way prevent your users from seeing other database by other means.<\/p>\n<div class=\"wp_syntax\">\n<table>\n<tbody>\n<tr>\n<td class=\"code\">\n<pre class=\"dos\">$conf['owned_only'] = true;<\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<h3><strong>Configuring PostgreSQL:<\/strong><\/h3>\n<p>Modify config file to accept the authentication from the remote networks.<\/p>\n<div class=\"wp_syntax\">\n<table>\n<tbody>\n<tr>\n<td class=\"code\">\n<pre class=\"dos\">vi \/var\/lib\/pgsql\/9.3\/data\/pg_hba.conf<\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>Please enter the value as per your requirements inIPv4 and Ipv6 connections and make sure it accepts md5 passwords.<\/p>\n<div class=\"wp_syntax\">\n<table>\n<tbody>\n<tr>\n<td class=\"code\">\n<pre class=\"dos\"># IPv4 local connections:\nhost\u00a0\u00a0\u00a0 all\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 all\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 127.0.0.1\/32\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 md5\nhost\u00a0\u00a0\u00a0 all\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 all\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 192.168.2.0\/24\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 md5\n# IPv6 local connections:\nhost\u00a0\u00a0\u00a0 all\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 all\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 ::1\/128\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 md5<\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<h3><strong>Configuring Apche:<\/strong><\/h3>\n<p>By-default phpPgAdmin places the web config file in <strong>\/etc\/httpd\/conf.d<\/strong> directory; it has the rules and access permission for the web access. In CentOS 7, web access is managed by <strong>mod_authz_core.c<\/strong>module; so normal allow or deny rules wont work even if you modify.<\/p>\n<div class=\"wp_syntax\">\n<table>\n<tbody>\n<tr>\n<td class=\"code\">\n<pre class=\"dos\">vi \/etc\/httpd\/conf.d\/phpPgAdmin.conf<\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>Default config will look like below.<\/p>\n<div class=\"command\">\n<p>Alias \/phpPgAdmin \/usr\/share\/phpPgAdmin<\/p>\n<p>&lt;Location \/phpPgAdmin&gt;<br \/>\n&lt;IfModule mod_authz_core.c&gt;<br \/>\n# Apache 2.4<br \/>\nRequire local<br \/>\n#Require host example.com<br \/>\n&lt;\/IfModule&gt;<br \/>\n&lt;IfModule !mod_authz_core.c&gt;<br \/>\n# Apache 2.2<br \/>\nOrder deny,allow<br \/>\nDeny from all<br \/>\nAllow from 127.0.0.1<br \/>\nAllow from ::1<br \/>\n# Allow from .example.com<br \/>\n&lt;\/IfModule&gt;<br \/>\n&lt;\/Location&gt;<\/p>\n<\/div>\n<p>Please comment <strong>Require local<\/strong> and add <strong>Require all granted<\/strong> just below to commented line, it will look like below.<\/p>\n<div class=\"command\">\n<p>Alias \/phpPgAdmin \/usr\/share\/phpPgAdmin<\/p>\n<p>&lt;Location \/phpPgAdmin&gt;<br \/>\n&lt;IfModule mod_authz_core.c&gt;<br \/>\n# Apache 2.4<br \/>\n<strong># Require local<\/strong><br \/>\n<strong>Require all granted<\/strong><br \/>\n#Require host example.com<br \/>\n&lt;\/IfModule&gt;<br \/>\n&lt;IfModule !mod_authz_core.c&gt;<br \/>\n# Apache 2.2<br \/>\nOrder deny,allow<br \/>\nDeny from all<br \/>\nAllow from 127.0.0.1<br \/>\nAllow from ::1<br \/>\n# Allow from .example.com<br \/>\n&lt;\/IfModule&gt;<br \/>\n&lt;\/Location&gt;<\/p>\n<\/div>\n<p>Restart the services.<\/p>\n<div class=\"wp_syntax\">\n<table>\n<tbody>\n<tr>\n<td class=\"code\">\n<pre class=\"dos\">systemctl restart postgresql-9.3.service\n\u00a0\nsystemctl restart httpd.service<\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<h3><strong>Accessing phpPgAdmin:<\/strong><\/h3>\n<p>Now access the phpPgAdmin from the browser, url will be <strong>http:\/\/your-ip-address\/phpPgAdmin<\/strong>.<\/p>\n<figure id=\"attachment_7254\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-7254\" src=\"http:\/\/www.itzgeek.com\/wp-content\/uploads\/2014\/07\/CentOS-7-phpPgAdmin-Home-page.jpg\" alt=\"CentOS 7 - phpPgAdmin Home page\" width=\"640\" height=\"474\" title=\"\"><figcaption class=\"wp-caption-text\">CentOS 7 \u2013 phpPgAdmin Home page<\/figcaption><\/figure>\n<p>Login by using postgres user.<\/p>\n<figure id=\"attachment_7255\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-7255\" src=\"http:\/\/www.itzgeek.com\/wp-content\/uploads\/2014\/07\/CentOS-7-phpPgAdmin-Login-page.jpg\" alt=\"CentOS 7 - phpPgAdmin Login page\" width=\"640\" height=\"473\" title=\"\"><figcaption class=\"wp-caption-text\">CentOS 7 \u2013 phpPgAdmin Login page<\/figcaption><\/figure>\n<p>You will get the database page.<\/p>\n<figure id=\"attachment_7256\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-7256\" src=\"http:\/\/www.itzgeek.com\/wp-content\/uploads\/2014\/07\/CentOS-7-phpPgAdmin-Databases.jpg\" alt=\"CentOS 7 - phpPgAdmin Databases\" width=\"640\" height=\"475\" title=\"\"><figcaption class=\"wp-caption-text\">CentOS 7 \u2013 phpPgAdmin Databases<\/figcaption><\/figure>\n<p>That\u2019s All. Hope this helped you, we welcome your comments.<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>phpPgAdmin is a web based administration tool for managing PostgreSQL database, it is very similar in look of phpMyAdmin. If you have a work experience on phpMyAdmin, you wont take much time in finding the&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"class_list":["post-267","post","type-post","status-publish","format-standard","hentry","category-database"],"_links":{"self":[{"href":"https:\/\/www.asianux.org.vn\/index.php\/wp-json\/wp\/v2\/posts\/267","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.asianux.org.vn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.asianux.org.vn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.asianux.org.vn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.asianux.org.vn\/index.php\/wp-json\/wp\/v2\/comments?post=267"}],"version-history":[{"count":0,"href":"https:\/\/www.asianux.org.vn\/index.php\/wp-json\/wp\/v2\/posts\/267\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.asianux.org.vn\/index.php\/wp-json\/wp\/v2\/media?parent=267"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.asianux.org.vn\/index.php\/wp-json\/wp\/v2\/categories?post=267"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.asianux.org.vn\/index.php\/wp-json\/wp\/v2\/tags?post=267"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}