Postgresql 11 on Amazon Linux 2

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

Then I pasted the following paragraph 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

Then:
 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

Some important notes at this address as well: 
https://yum.postgresql.org/repopackages.php#pg11