3

I'm running Ubuntu 18.04 on an AWS box. I have postgresql 10.22. We just update the rds and, apparently, 10.22 is not compatible with pg server version 14. So I want to upgrade. I ran $ sudo apt-get update $ sudo apt-get install postgresql-client-14 response: E: Unable to locate package postgresql-client-14

I ran $ sudo apt-get install postgresql-client Response: postgresql-client is already the latest version (10+190ubuntu0.1). But https://www.postgresql.org/ftp/source/ shows the latest version as 15.1 so that's wrong.

I ran $ sudo apt-get upgrade postgresql-client Reponse: https://www.postgresql.org/ftp/source/

I'm stuck! How do I update the postgreql-client?

PS I looked at Unable to install files with apt-get: "unable to locate package" and their advice was to do "sudo apt-get update" before the install which is why I did that. What's the NEXT thing after that? ;-)

2 Answers 2

6

To have the PostgreSQL 14 client on your Ubuntu 18.04 server, you'll need to add the official PostgreSQL repository and perform the installation. Here's how you can do that:

  1. Connect to your server

  2. Create a new apt sources file and add the PostgreSQL repository:

    sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/postgres.list'
    
  3. Import the GPG signing key for this repository:

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

    sudo apt update
    

    If no errors are reported, we can continue.

  5. Install the PostgreSQL 14 client:

    sudo apt install postgresql-client-14
    

If you will not need the PostgreSQL 10 client that is currently installed, it may make sense to remove it so that you know every connection is made with the 14 client.

0

It looks like postgresql-client-14 is not in the default 18.04 apt repository. It is in the 22.04 repos so you can upgrade your Ubuntu or follow the instructions here to add the PostgresSQL Apt repositories and install the version you need.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .