Postgresql , phpPGAdmin and pgadmin 3 can be installed from synaptic.
$ sudo apt-get install postgresql phppgadmin pgadmin3
After installation some configuration needs to be done. First of all setup the password of the user 'postgres'
which is the default user of postgresql.
Type the following in the terminal
$ sudo -u postgres psql
This will start the postgresql shell/console. Now to change the password type 'password postgres;'
$ sudo -u postgres psql psql (9.1.5) Type "help" for help. postgres=# postgres=# postgres=# password postgres; Enter new password: Enter it again: postgres=#
Now psql will ask for a new password twice. Enter the new password and continue. Type 'q' and hit enter to quit.
After installation the postgres password of postgresql can be changed like this :
To create a database the following command can be run from the terminal
$ sudo -u postgres createdb mydb
Pgadmin is a gui tool to administer and manage postgresql databases etc. To run pgadmin check the gnome/kde menu or just run pgadmin3 from terminal.
Go to File > Add Server and fill in the details
Name : Anything
Host : 127.0.0.1
Username : postgres
Password : Whatever you entered in the previous step.
After clicking OK it should connect and there should be an option on the left window pane to manage the databases.
After installing phppgadmin there should be symlink /var/www/phppgadmin which would point to /usr/share/phppgadmin
If the symlink does not exist then it can be created by issuing the following command
$ ln -s /usr/share/phppgadmin /var/www/phppgadmin
Now open the url "localhost/phppgadmin" in your browser. If it shows Forbidden then try to change the permissions of the directory /usr/share/phppgadmin. If that does not work then create a separate symlink, e.g. /var/www/postgres and use that.
Trying to login with user : postgres and password : created above might give the error :
"Login disallowed for security reasons"
To fix this edit /usr/share/phppgadmin/conf/config.inc.php
and change :
$conf['extra_login_security'] = true; to $conf['extra_login_security'] = false;
Now login should work fine. The extra_login_security option disables the login of only certain usernames like psql, postgress, root and administrator. Alternatively create a separate user.