Install
Install
Usually, the version from the repositry will be installed. If we want to install another version, we must add the PostgreSQL repository.
Install PostgreSQL 9.4 in Ubuntu 14.04
The 9.4 version of PostgreSQL was introduced in Ubuntu 14.10, so we must update the sources and install it afterwards.
_$: sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
_$: wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
_$: sudo apt-get update
_$: sudo apt-get upgrade
_$: sudo apt-get install postgresql-9.4
Notes:
-
If the first version installed from the repository (9.3) is running in the
5432
port, which is the default port, the new version will run in the5433
port. We will need to specify the port whenever we want to work with the 9.4 version. -
Our host (client) will have the pgAdmin version installed from repository, so it is probable that pgAdmin does not work with the 9.4 version.
_$: createuser -p 5433 <user> -P
_$: createdb -p 5433 -O <user> <database>
_$: psql -p 5433 -U <user> <database>
database=> \q
Accept connections in the new version:
/etc/postgresql/9.4/main/pg_hba.conf:
-------------------------------------
...
# "local" is for Unix domain socket connections only
local all all md5
# IPv4 local connections:
host all all 127.0.0.1/32 md5
host all all 192.168.1.0/24 md5
/etc/postgresql/9.4/main/postgresql.conf:
-----------------------------------------
...
#------------------------------------------------------------------------------
# CONNECTIONS AND AUTHENTICATION
#------------------------------------------------------------------------------
# - Connection Settings -
listen_addresses = '*'
port = 5433
...
_$: service postgresql restart
* Restarting PostgreSQL 9.3 database server [ OK ]
* Restarting PostgreSQL 9.4 database server [ OK ]
_$: service postgresql status
9.3/main (port 5432): online
9.4/main (port 5433): online