Deploy Postgres11 to Elastic Beanstalk - Requires /etc/redhat-release

Alternatively, you can build posgresql from source:

wget https://ftp.postgresql.org/pub/source/v11.5/postgresql-11.5.tar.gz

tar zxvf postgresql-11.5.tar.gz

cd postgresql-11.5

./configure --without-readline

make

make install


I have the same problem with PostgreSQL 10 for a Django 2.1 project on AWS Elastic Beanstalk.

The issue was introduced last week around 17 Apr 2019 to make sure the operating system is an actual Red Hat release (which Amazon Linux is not). I found some details on the PostgreSQL mailing list:

"Amazon Linux support was removed years ago actually. I just made sure that our repo file reflects that."
(BUG #15768: Removed rpms and now require /etc/redhat-release)

One poster on the mailing list suggested the following fix:

"We have temporarily mitigated the issue by using rpm and explicitly ignoring the repositories dependencies, but that seems like a band-aid fix for the real problem which is that dependency shouldn’t be there."

Personally, I've done the same as you, Scott, I've simply reverted to the PostgreSQL 9.6 client packages that AWS supplies directly. As long as Django and psycopg support that release, this works fine.

However, the long-term fix is for AWS to finally provide platforms with Amazon Linux 2...


PostgreSQL 11 is not yet available from Amazon but PostgreSQL 10 is. I'm using Amazon Linux release 2 (Karoo) reported by cat /etc/system-release. To enable installation:

$ sudo amazon-linux-extras enable postgresql10

Once you enable this extra, you'll then see many packages for PostgreSQL 10 available through yum that can be installed normally:

$ yum list postgresql*
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
Installed Packages
postgresql.x86_64                    10.4-5.amzn2.0.2    @amzn2extra-postgresql10
postgresql-devel.x86_64              10.4-5.amzn2.0.2    @amzn2extra-postgresql10
postgresql-libs.x86_64               10.4-5.amzn2.0.2    @amzn2extra-postgresql10
Available Packages
postgresql-contrib.x86_64            10.4-5.amzn2.0.2    amzn2extra-postgresql10
postgresql-docs.x86_64               10.4-5.amzn2.0.2    amzn2extra-postgresql10
postgresql-libs.i686                 10.4-5.amzn2.0.2    amzn2extra-postgresql10
postgresql-plperl.x86_64             10.4-5.amzn2.0.2    amzn2extra-postgresql10
postgresql-plpython.x86_64           10.4-5.amzn2.0.2    amzn2extra-postgresql10
postgresql-plpython3.x86_64          10.4-5.amzn2.0.2    amzn2extra-postgresql10
postgresql-pltcl.x86_64              10.4-5.amzn2.0.2    amzn2extra-postgresql10
postgresql-server.x86_64             10.4-5.amzn2.0.2    amzn2extra-postgresql10
postgresql-static.x86_64             10.4-5.amzn2.0.2    amzn2extra-postgresql10
postgresql-test.x86_64               10.4-5.amzn2.0.2    amzn2extra-postgresql10
postgresql-test-rpm-macros.x86_64    10.4-5.amzn2.0.2    amzn2extra-postgresql10
postgresql-upgrade.x86_64            10.4-5.amzn2.0.2    amzn2extra-postgresql10
postgresql-upgrade-devel.x86_64      10.4-5.amzn2.0.2    amzn2extra-postgresql10

Here is my maverick solution for the latest Amazon Linux 2 ami:

sudo su
cd /etc/yum.repos.d
nano pgdg.repo

Then I pasted this into the nano editor with its newly created pgdg.repo file:

[pgdg11]
name=PostgreSQL 11 $releasever - $basearch
baseurl=https://download.postgresql.org/pub/repos/yum/11/redhat/rhel-7.5-x86_64
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG-11

Further commands are:

sed -i "s/rhel-\$releasever-\$basearch/rhel-7.5-x86_64/g" "/etc/yum.repos.d/pgdg.repo"
yum groupinstall "PostgreSQL Database Server 11 PGDG"

Create a new PostgreSQL database cluster:

/usr/pgsql-11/bin/postgresql-11-setup initdb

Now execute the following command to start and enable the postgresql services:

systemctl enable postgresql-11
systemctl start postgresql-11

Still, keep in mind the notes at this address: Link to Postgresql.org