Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in AWS by (19.1k 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:

[ec2-user@ip-X-X-X-X ~]$ 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:

[ec2-user@ip-X-X-X-X ~]$ 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.4k 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

You can learn in-depth about SQL statements, queries and become proficient in SQL queries by enrolling in our industry-recognized SQL training.

Related questions

Want to get 50% Hike on your Salary?

Learn how we helped 50,000+ professionals like you !

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
asked Jul 8, 2019 in AWS by Amyra (12.9k points)
0 votes
1 answer

Browse Categories

...