PostgreSQL installation and settings on Ubuntu 12.04


Updated for Ubuntu GNU/Linux 13.04 (Raring Ringtail).

  • Install latest PostgreSQL 9.1 in console:
sudo apt-get install postgresql libpq-dev
  • PostgreSQL has a super user is called postgres. Change user to the PostgreSQL user:
sudo su - postgres
  • Change password of postgres user:
psql -d postgres -U postgres
psql (9.1.3) Type "help" for help
postgres=# alter user postgres with password 'YOUR_NEW_PASSWORD';
postgres=# \q
#logout postgres user
  • Restart the PostgreSQL server:
sudo /etc/init.d/postgresql restart

pgAdmin III: PostgreSQL administration and management tools

  • If pgAdminIII is not installed, the installation is easy:
sudo apt-get install pgadmin3
  • Open pgAdminIII and add new localhost server. Go to menu File > Add Server as the following screenshot:


Set up pgAdmin III server instrumentation:
When connecting to a PostgreSQL database using pgAdmin you may receive an error letting you know that the server instrumentation is not installed.

  • Install postgresql-contrib package:
sudo apt-get install postgresql-contrib
  • Install adminpack extension:
sudo -u postgres psql
postgres=# CREATE EXTENSION "adminpack";
postgres=# \q


  1. Alan Perkins
    Jul 25, 2013 @ 10:56:08

    These are the clearest, most effective instructions I have seen anywhere for this – thank you very much for taking the time to explain it so well.


  2. andrey
    Aug 02, 2013 @ 10:31:28

    Not so far I have found new cool tool to work with PostgreSQL on ubuntu — Valentina Studio. Its free edition can do things more than many commercial tools!!
    I very recommend check it.


  3. My ubuntu developer pc: installations and settings
    Aug 30, 2013 @ 17:42:24

    [...] See my blog post: PostgreSQL installation and settings on Ubuntu [...]


Leave a Reply