PostgreSQL is powerful high-performance object-relational database management system. This tutorial is going to show you to install PostgreSQL on Ubuntu system. Also, I will show you how to install phpPgAdmin, a web based front end for PostgreSQL database. This tutorial is applicable to most recent Ubuntu version including Ubuntu 15.10, Ubuntu 15.04 and also Ubuntu 14.04 LTS.
Steps to install PostgreSQL, phpPgAdmin and Apache2 on Ubuntu
Open Terminal and paste this command
sudo apt-get install postgresql postgresql-contrib phppgadmin
Output
Next we need to configure PostgreSQL user. Type the following command on Terminal
sudo su
su – postgres
Now enter postgresql prompt
psql
Output:
dhani@dhani-ubuntu:~$ sudo su
root@dhani-ubuntu:/home/dhani# su – postgres
postgres@dhani-ubuntu:~$ psql
psql (9.4.4)
Type “help” for help.
Now change the password for postgres user
\password postgres
Enter your new password twice.
Type \quit to exit.
At this point we’re successfully install and configure postgresql server. Now we need to configure some other things.
Configure Apache
cd /etc/apache2/conf-available/
sudo nano phppgadmin.conf
Comment out the line #Require local by adding a # in front of the line and add below the line allow from all so that you can access from your browser.
Configure phpPgAdmin
cd /etc/phppgadmin/
sudo nano config.inc.php
Find the line $conf[‘extra_login_security’] = true; and change the value to false so you can login to phpPgAdmin with user postgres. Change the value to false.
Restart postgres and Apache
sudo systemctl restart postgresql
sudo systemctl restart apache2
Now open web browser and type the following address
http://yourip/phppgadmin