Reputation: 189
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
Upvotes: 14
Views: 52542
Reputation: 439
As of September 2024, for Amazon Linux 2023, the following command installs Postgresql 15 client programs:
sudo dnf install postgresql15
Upvotes: 3
Reputation: 4681
as of today - i was able to find version 15 of postgressql in linux ec2 so run as below
sudo yum install postgresql15
This will avoid error Error: Unable to find a match: postgresql14
Upvotes: 1
Reputation: 3128
For my case, the original Amazon Linux 2 AMI was modified (hardening) to follow the organization security checklist. So non of the above approach work for me.
The approach that works for me is install the postgresql by Amazon Linux Extra repository
sh-4.2$ sudo amazon-linux-extras install postgresql14
<....>
sh-4.2$ psql --version
psql (PostgreSQL) 14.8
Reference
FAQ - Amazon Linux Extras
Amazon Linux Extra repository
Upvotes: 7
Reputation: 15104
Adding to James' answer, the complete list of Amazon Linux packages is also published to the respective distro Release Notes which you can search online.
E.g.: for Amazon Linux 2023:
https://docs.aws.amazon.com/linux/al2023/release-notes/all-packages.html
Here I was able to find postgresql15
and other package directly in the web.
So I'm my case this did the trick for me: sudo yum -y install postgresql15
There's also a comparison section with previous distros which will show new packages, removed packages, and updated packages.
Upvotes: 15
Reputation: 386
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.
Upvotes: 25
Reputation: 17815
postgresql
packagesudo yum install postgresql
As mentioned by @Anon Coward in comments, this package contains the postgresql client. Check it with
yum search postgresql
Upvotes: 5