pg_dump: how to install on Amazon Linux for PostgreSQL 9.5.2?

23,464

Solution 1

Ok, found it.

(1) Install the repo:

$ sudo rpm -Uvh https://download.postgresql.org/pub/repos/yum/9.5/redhat/rhel-6-x86_64/pgdg-ami201503-95-9.5-3.noarch.rpm

- Update: 9.5.2-> 9.5.3 Found the repo here.

(2) Then install the package:

$ sudo yum install postgresql95

Now you can dump your RDS database to a near by ec2 instance!

Solution 2

You can actually install a newer version of Postgres with the Amazon Extras Library: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/amazon-linux-ami-basics.html#extras-library

I needed Postgres 10, so for me the command was:

sudo amazon-linux-extras install postgresql10

You can view a list of extras Amazon Linux provides by using this command:

amazon-linux-extras list
Share:
23,464
Amir Mehler
Author by

Amir Mehler

Updated on February 13, 2020

Comments

  • Amir Mehler
    Amir Mehler over 4 years

    I used to install and do:

    $ sudo yum install -y postgresql94-server postgresql94
    $ pg_dump -h name-of-db.us-east-1.rds.amazonaws.com -U user dbName > dump
    

    After RDS upgrade to 9.5.2 I get this:

    pg_dump: server version: 9.5.2; pg_dump version: 9.4.5
    pg_dump: aborting because of server version mismatch
    

    I can't find a proper package for Amazon Linux

    This didn't help me: http://tecadmin.net/install-postgresql-9-5-on-centos/

    Can you?

  • McLovin
    McLovin almost 7 years
    In order for me to get this to work I first copied the proper link from yum.postgresql.org/repopackages.php. Then I had to uninstall my existing postgres sudo yum remove postgresql92 before installing the new one.
  • antiplayer
    antiplayer about 5 years
    amazon-linux-extras is available fro Amazon Linux 2 only
  • Aamir
    Aamir over 3 years
    Thanks! For Postgres 11, simply change to sudo amazon-linux-extras install postgresql11
  • Vivek Raveendran
    Vivek Raveendran about 2 years
    I know it is super late, but this became useful for me and might come in handly for others -> sudo amazon-linux-extras install postgresql11 (just now :) )