0 votes
1 view
in AWS by (19.2k points)

I have successfully launched new AWS RDS PostgreSQL v10 instance and need to install PostgreSQL v10 client on Amazon Linux EC2 instance.

I have tried to install it with yum, but it can't find the package for v10:

[[email protected] ~]$ sudo yum install -y postgresql10

Loaded plugins: priorities, update-motd, upgrade-helper

amzn-main      | 2.1 kB 00:00:00

amzn-updates  | 2.5 kB 00:00:00

No package postgresql110 available.

Error: Nothing to do

Previously I managed to install PostgreSQL client v9.5 with:

[[email protected] ~]$ sudo yum install -y postgresql95

I guess I need to add Postgres yum repository, as mentioned in https://www.postgresql.org/download/linux/redhat/. But what Platform should I choose for Amazon Linux? Red Hat?

1 Answer

0 votes
by (44.6k points)

Check Amazon Linux version

[ec2-user ~]$ cat /etc/system-release

Amazon Linux release 2.0 (2017.12) LTS Release Candidate

Install RHEL 7 yum repo for PostgreSQL

[ec2-user ~]$ sudo yum install -y  https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-7-x86_64/pgdg-redhat10-10-2.noarch.rpm

[ec2-user ~]$ sudo sed -i "s/rhel-\$releasever-\$basearch/rhel-latest-x86_64/g" "/etc/yum.repos.d/pgdg-10-redhat.repo"

Install PostgreSQL Client v10

[ec2-user ~]$ sudo yum install -y postgresql10

[ec2-user ~]$ psql --version

psql (PostgreSQL) 10.3

And there is one-liner if you are Amazon Linux 2 user:

sudo amazon-linux-extras install postgresql10

You can learn more about the most used Amazon service on AWS EC2

Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...