How to install PostgreSQL 13 in Ubuntu?

23,939

Solution 1

If the version included in your version of Ubuntu is not the one you want, you can use the PostgreSQL Apt Repository. This repository will integrate with your normal systems and patch management, and provide automatic updates for all supported versions of PostgreSQL throughout the support lifetime of PostgreSQL.

The PostgreSQL Apt Repository supports the current LTS versions of 18.04 & 16.04

on the following architectures: amd64 i386 ppc64el

While not fully supported, the packages often work on other non-LTS versions as well, by using the closest LTS version available. To use the apt repository, follow these steps:

Create the file /etc/apt/sources.list.d/pgdg.list and add a line for the repository

deb http://apt.postgresql.org/pub/repos/apt/ YOUR_UBUNTU_DISTRIB_CODENAME_HERE-pgdg main

Import the repository signing key, and update the package lists

wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update

From https://www.postgresql.org/download/linux/ubuntu/

Solution 2

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

# Specify/replace the version number you want to install

sudo apt-get -y install postgresql-13

Solution 3

The latest version of postgresql-client and postgresql-11 in the Ubuntu 19.04 and 19.10 default repositories is version 11. To install these packages run:

sudo apt install postgresql-client postgresql-11

The latest version of postgresql-client and postgresql-XX in the Ubuntu 20.04 default repositories is version 12.

sudo apt install postgresql-client-12 postgresql-12
Share:
23,939

Related videos on Youtube

Thirumal
Author by

Thirumal

Github: M-THIRUMAL

Updated on September 18, 2022

Comments

  • Thirumal
    Thirumal almost 2 years

    How to install PostgreSQL-13 in Ubuntu 20.04?

  • metters
    metters over 4 years
    Tried this. I get an error: E: Unable to locate package postgresql-12
  • Madeo
    Madeo over 4 years
    nope, not working: E: Unable to locate package postgresql-12
  • Madeo
    Madeo over 4 years
    You need to add the repository before this wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add - then update sudo apt-get update and then install it
  • Xetera
    Xetera over 3 years
    Not sure why I couldn't find this answer anywhere else but this worked for me.