How to install PostgreSQL 9.3 on Ubuntu 14.04 LTS Server

In this post we learn to how to install PostgreSQL 9.3 on Ubuntu 14.04 Server edition, also we learn about basic configuration, change password, directory for config file and a little more.

What is PostgreSQL?

PostgreSQL, often simply Postgres, is an object-relational database management system (ORDBMS) with an emphasis on extensibility and standards-compliance.
by Wikipedia

Before begin, please check your repository whit the next command:

Check that all is ok, and continue with the next:

1) Install PostgreSQL Server and another libs

2) Check in your installation

You can use the next command for check if postgresql was install correctly and is work:

3) Checking version

For checking version that we have installed we use the next command:

We could see:

4) Update postgres user password

After install our postgres server, we need update password for user postgres, we will do that with the next commands:

For to access to postgres console, we have two options:

A) Directly with a command:

B) With user postgres (login):

When we are in the postgres console we need execute the next sentence sql:

For to exit to postgres console we use the next command:

5) Directory for config files

In Ubuntu Server the config file directory is in: /etc/postgresql/9.3/main/

The files for configuration advanced are the next:

  • pg_hba.conf: for enable remote connection (review this file)
  • postgresql.conf: for many others configuration like: data directory, port setting, max connection, and some many more, review this file.

For more information you can see the next links: