How to Add PostgreSQL Apt Repository for Debian-Based OSes

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

GNU/Linux Debian-based Add PostgreSQL Repository

Hi! The Tutorial shows you Step-by-Step How to Add PostgreSQL Apt Repository for Debian-Based GNU/Linux Systems.

So the PostgreSQL Apt Repo Setup is Valid also for:

  • Kali
  • MX Linux
  • Deepin
  • Parrot
  • antiX
  • SparkyLinux
  • Q4OS
  • Vanilla OS
  • Netrunner
  • Voyager Debian
  • MakuluLinux
  • Elive
  • LMDE
  • Parsix
How to Add PostgreSQL Apt Repository for Debian-based OSes - Featured
  1. 1. Launching Terminal

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

  2. 2. Setting Up PostgreSQL Repository

    First, Make the PostgreSQL Apt Repo File
    (For Kali you should use the Stable or Testing Repo)
    Then for Debian Sid/Unstable Based OSes play:

    su -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ sid-pgdg main" >> /etc/apt/sources.list.d/pgdg.list'
    
    Especially relevant: in case try to use “sudo su -c” instead of “su -c”.

    So for Debian Testing
    And for All Debian Testing Based (Trixie), like SparkyLinux:

    su -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ trixie-pgdg main" >> /etc/apt/sources.list.d/pgdg.list'
    
    Again for Debian Stable (Bookworm)
    And for All Debian Stable Based, like MX Linux, Deepin, antiX…:
    su -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ bookworm-pgdg main" >> /etc/apt/sources.list.d/pgdg.list'
    

    Next for Debian OldStable (Bullseye)
    And for All the Debian OldStable Derivatives:

    su -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ bullseye-pgdg main" >> /etc/apt/sources.list.d/pgdg.list'
    

    Next for Debian Buster:

    su -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ buster-pgdg main" >> /etc/apt/sources.list.d/pgdg.list'
    

    Instead, for Debian Stretch

    su -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ stretch-pgdg main" >> /etc/apt/sources.list.d/pgdg.list'
    
  3. 3. Importing PostgreSQL GPG Key

    Then to Import Postgres Repo 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 Repos

    Finally, Refresh Apt Repositories
    Simply with:

    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 Debian Like

    Debian PostgreSQL Install

QuickChic Theme • Powered by WordPress