In this blog, I'll discuss on how to setup phpPgAdmin. But before going any further where can phpPgAdmin be used? PhpPgAdmin is a counter part of phpMyAdmin. If phpMyAdmin is the web admin user interface managing MySQL server then phpPgAdmin is for PostgreSQL. PhpPgAdmin was created to ease the administration of PostgreSQL. Below are the requirements needed to build the admin.
Requirements:
- PHP installed
- PostgreSQL installed (for instruction on how to install postgreSQL server see http://www.designmagick.com/article/2/Starting-Out/Installing-PostgreSQL)
- if you are running CentOS distro or the like then you can just do yum to install all of these needed packages.
Note: by default the installation of Postgres creates user postgres with no password (postgres by default is the superuser for PostgreSQL).
Here are the steps to take to be able to make phpPgAdmin running:
1. Download phpPgAdmin
# cd /usr/src/
# wget http://downloads.sourceforge.net/project/phppgadmin/phpPgAdmin%20%5Bstable%5D/phpPgAdmin-4.2.2/phpPgAdmin-4.2.2.tar.gz?use_mirror=nchc
2. Extract the package
# tar xvzf phpPgAdmin-4.2.2.tar.gz
3. Rename the folder and move folder to the web server document root (assuming your document root is at /var/www/html)
# mv phpPgAdmin-4.2.2 /var/www/html/phpPgAdmin
4. You should be able to browse phpPgAdmin on browser
http://xxx.xxx.xxx.xxx/phpPgAdmin/
5. Notice that what ever you put you always get "Login Failed". To correct that edit config.inc.php (located at /var/www/html/phpPgAdmin/conf/config.inc.php), set $conf['extra_login_security'] to false for now.
from
$conf['extra_login_security'] = true;
to
$conf['extra_login_security'] = false;
6. Do also the changes as follow on config.inc.php
from
$conf['servers'][0]['host'] = '';
to
$conf['servers'][0]['host'] = 'localhost'; // this is to allow tcp login
7. Now login to phpPgAdmin using username postgres without password
8. Create a user with password. (Another admin since it is advisable to use other super user account to avoid hack).
9. Once a new admin user has been created. Logout from the phpPgAdmin.
10. Edit the postgreSQL configuration (pg_hba.conf) to set md5 authentication for all connecting client via tcp. (By default all created user are trusted even without authentication). Do the changes as follow.
# vi /var/lib/pgsql/data/pg_hba.conf
from
host all all 127.0.0.1 255.255.255.255 trust
to
host all postgres 127.0.0.1 255.255.255.255 trust
host all all 127.0.0.1 255.255.255.255 md5
save the file and restart postgresql
# service postgresql restart
11. Edit again the config.inc.php and do the changes as follow:
# vi /var/www/html/conf/config.inc.php
from
$conf['extra_login_security'] = false;
to
$conf['extra_login_security'] = true;
12. Now you should be able to login using the new admin account created with password. Postgres super user will always be denied to login on phpPgAdmin for security reason.
All should be working fine from this point. You now have a running phpPgAdmin. I hope this helps for those who are establishing their PostgreSQL web admin. Cheers, Take care and God Bless!!!!
No comments:
Post a Comment