How To Install PostgreSQL 11 On Ubuntu 18.04

What is new in PostgreSQL-11 ?


The PostgreSQL Global Development Group has released an update to all supported versions of our database system, including 11.2, 10.7, 9.6.12, 9.5.16, and 9.4.21. This release changes the behaviour in how PostgreSQL interfaces with fsync() and includes fixes for partitioning and over 70 other bugs that were reported over the past three months.

To see what changed in detail you can visit PostgreSQL-11.2

Lets move to installation of PostgreSQL-11

Step 1: Add PostgreSQL Repository to Ubuntu

Very first thing you need to do is add repository key , this key is to authenticate and validate packages from repository 
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -sc)-pgdg main" > /etc/apt/sources.list.d/PostgreSQL.list'

Step 2: Update and Install PostgreSQL

Now key are added, run the commands below to update and install the latest PostgresSQL packages..
sudo apt update
sudo apt-get install postgresql-11

Step 3: You can use below commands to check status , start , stop cluster.
pg_ctlcluster 11 main start
pg_ctlcluster 11 main stop
pg_ctlcluster 11 main status

Example : 
postgres@pgupgrade02:~ $ pg_ctlcluster 11 main status
pg_ctl: server is running (PID: 8058)
/usr/lib/postgresql/11/bin/postgres "-D" "/var/lib/postgresql/11/main" "-c" "config_file=/etc/postgresql/11/main/postgresql.conf"

Step 4: Connecting to database 
postgres@pgupgrade02:~ $ psql -p 5433 -U postgres -d postgres
psql (11.2 (Ubuntu 11.2-1.pgdg18.04+1))
Type "help" for help.

postgres=# select version();
                                                             version                                                              
----------------------------------------------------------------------------------------------------------------------------------
 PostgreSQL 11.2 (Ubuntu 11.2-1.pgdg18.04+1) on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 7.3.0-27ubuntu1~18.04) 7.3.0, 64-bit
(1 row)



That's it.. 😊!







Do You Like This Blog ?      


Comments

Popular posts from this blog

PostgreSQL Job scheduler “pg_cron”

PgBouncer Authentication