I am trying to install postgresql for the meta data of hive on Amazon EC2 Linux machine. And at that point, I am trying to connect postgresql outside docker image. Inside, I can connect the postgresql.
I tried this command:
[ec2-user@ip-****-***-** ~]$ sudo yum install postgresql-client -y
and the result:
Failed to set locale, defaulting to C
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
amzn2-core | 3.7 kB 00:00:00
No package postgresql-client available.
Error: Nothing to do
To ensure locale, I tried these ones:
[ec2-user@ip-***-***-*** ~]$ echo "$LANG"
en_US.UTF-8
[ec2-user@ip-***-***-*** ~]$ echo "$LC_CTYPE"
UTF-8
Then, I tried this one install postgresql-client lastly:
[ec2-user@ip-***-***-*** ~]$ sudo amazon-linux-extras install postgresql-client
Topic postgresql-client is not found.
I am not so familiar with these technologies, if you can help I will be so appreciated
No match for argument: postgresql
...I found that AWS Linux is a dynamic changing OS, so here is the current method + how to detect a new way to do this...
(I have Machine Image (AMI): Amazon Linux 2022)
$ sudo yum update
$ sudo yum install postgresql13
$ psql --version
psql (PostgreSQL) 13.5
Try this first ...
$ sudo yum update
$ sudo yum search "postgres"
... and look in the output for a line like this: postgresql13.aarch64 : PostgreSQL client programs
. This tells you the current version of an installable client package name - in this case postgresql13
. Now you know which package to install and avoid: No match for argument: postgresql
error.
TLDR;
It seems, for Linux that Amazon now says to use yum
directly vs. the old amazon-linux-extras
here... Install software packages on an Amazon Linux instance. Then you wonder, how to know which package name to use to install it, which is here: Find software packages on an Amazon Linux instance. I used a small part of the name as a 'key' to search for: sudo yum search "postgres"
which got me the answer, by looking at the output.
This currently works for my version of Amazon linux:
$ uname -a
Linux ip-0-0-0-0.ec2.internal 5.15.43-20.123.amzn2022.aarch64 #1 SMP Thu May 26 17:03:36 UTC 2022 aarch64 aarch64 aarch64 GNU/Linux
This is a new instance with almost nothing added, not even additional yum
archives, YMMV.