How to Add PostgreSQL Apt Repository for Ubuntu-Based OSes

October 14, 2020 | By the+gnu+linux+evangelist.

GNU/Linux Ubuntu-based Add PostgreSQL Apt Repository

Hi! The Tutorial shows you Step-by-Step How to Add PostgreSQL Apt Repository for Ubuntu 64-bit Based Systems.

So the PostgreSQL Apt Repo Setup is Valid also for:

  • Linux Mint
  • Lubuntu
  • Kubuntu
  • Xubuntu
  • Zorin OS
  • Elementary OS
  • Linux Lite
  • Bodhi Linux
  • Kde Neon
  • Pop!_OS
  • Voyager
  • Trisquel
  • LXLE
  • feren OS
  • Peppermint
  • Q4OS
  • Linux Ultimate Edition
How to Add PostgreSQL Apt Repository for Ubuntu-based OSes - Featured
  1. 1. Terminal Getting-Started Guide

    How to Quick-Start with Command Line on Ubuntu GNU/Linux:

    Or Login in the Server Shell.

  2. 2. Setting Up PostgreSQL Repository

    First, Make the PostgreSQL Apt Repo File
    The General form of the Command is:

    sudo su -c 'echo "deb [arch=amd64] http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg main" >> /etc/apt/sources.list.d/pgdg.list'
    
    The “$(lsb_release -cs)” instruction output the Release Name.
    But for the Derived Distros you may need to Set it Manually.

    So for Ubuntu 20.04 Focal Based like: Mint 21.x, Elementary OS 7.x, Zorin OS 17.x, Bodhi 7.x, Lite 6.x…:

    sudo su -c 'echo "deb [arch=amd64] http://apt.postgresql.org/pub/repos/apt/ jammy-pgdg main" >> /etc/apt/sources.list.d/pgdg.list'
    

    Again for Ubuntu 20.04 Focal Based like: Mint 20.x, Elementary OS 6.x, Zorin OS 16.x, Bodhi 6.x, Lite 5.x…:

    sudo su -c 'echo "deb [arch=amd64] http://apt.postgresql.org/pub/repos/apt/ focal-pgdg main" >> /etc/apt/sources.list.d/pgdg.list'
    

    In Ubuntu 18.04 Based like: Mint 19.x, Elementary OS 5.x, Zorin OS 15.x, Bodhi 5.x, Lite 4.x…:

    sudo su -c 'echo "deb [arch=amd64] http://apt.postgresql.org/pub/repos/apt/ bionic-pgdg main" >> /etc/apt/sources.list.d/pgdg.list'
    

    Instead, for all Ubuntu 16.04 LTS Based systems, so also on Mint 18.x,…:

    sudo su -c 'echo "deb [arch=amd64] http://apt.postgresql.org/pub/repos/apt/ xenial-pgdg main" >> /etc/apt/sources.list.d/pgdg.list'
    

    Finally, for all the Ubuntu 14.04 Based systems, Linux-Mint-17.x,…

    sudo su -c 'echo "deb [arch=amd64] http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main" >> /etc/apt/sources.list.d/pgdg.list'
    
  3. 3. Adding PostgreSQL GPG Key

    Then Import GPG Key
    Just run:

    wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
    (For the Newer Release in case of apt-key Issue see: Gpg.d Keyring Setup Guide.)
  4. 4. Refreshing PostgreSQL Repos

    Finally, Refresh Apt Repositories
    Simply play:

    sudo apt update
    Authenticate with the User Admin Pass.
    If Got “User is Not in Sudoers file” then see: How to Enable sudo.
  5. 5. Installing PostgreSQL

    How to Install PostgreSQL on Ubuntu Like

    Ubuntu PostgreSQL Install

QuickChic Theme • Powered by WordPress