Wednesday, 21 August 2013

Installing phppgadmin and configuring it with postgresql in linux

phppgadmin can be used for developing application which uses psql for database.

Lets begin :

1.install postgresql  by  $ sudo apt-get install postgresql

2. install phppgadmin by $ sudo apt-get install phppgadmin

3. Create a user for postgresql by $ sudo -u postgres createuser -d -r -P username
then enter password for the user created.

4.make apache acknowledge postgresql as a database server by editing the conf file of apache
$sudo gedit '/etc/apache2/apache2.conf'  
and add this in a new line  at the end                   Include /etc/phppgadmin/apache.conf  

5.Restart apache2 server by  $ sudo /etc/init.d/apache2 restart

6. If localhost/phppgadmin throws up 404  then configure postgresql by
editing the conf file  $ sudo gedit /etc/postgresql/9.1/main/postgresql.conf

and add this at the end of file in a new line           listen_addresses = 'localhost'

7. now edit  pg_hba.conf by $ sudo vi /etc/postgresql/9.1/main/pg_hba.conf

Replace         local all all ident sameuser            with              local   all         all                               md5

That would be it.

you can also access postgres by  $ sudo -u postgres psql username

No comments:

Post a Comment