Reputation: 1822
I want to install PostgreSQL 11 on an EC2 instance, based on the Amazon Linux AMI 2 image. Following posts, SO questions, and finding the latest Postgresl yum repository, I tried:
sudo yum install https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm
I get this error:
--> Processing Dependency: /etc/redhat-release for package: pgdg-redhat-repo-42.0-4.noarch
--> Finished Dependency Resolution
Error: Package: pgdg-redhat-repo-42.0-4.noarch (/pgdg-centos11-11-2.noarch)
Requires: /etc/redhat-release
I'm stuck.. is there a clean way to overcome this problem?
Upvotes: 14
Views: 15172
Reputation: 3801
I had issues with the Amazon Linux 2 AMI for CodeBuild using Python 3 but amazon-linux-extras
only using Python 2 (totally bizarre considering Python 2 has been sunset, I know). From this thread you can copy the amazon_linux_extras
from the Python 2 site-packages
to the Python 3 one.
To find the location of amazon-linux-extras
use
find -type d -name "amazon_linux_extras" # note the underscore (_), not dash (-)
To find the Python 3 site-packages
directory
find -type d -name "site-packages"
To copy across
cp -r /path/to/amazon_linux_extras /path/to/python3/site-packages
Once I had done that, I used @Hassan's answer to upgrade to PostgreSQL 11.
Upvotes: 0
Reputation: 1317
I successfully installed 11.5 on Amazon Linux using
sudo amazon-linux-extras install postgresql11
Upvotes: 16
Reputation: 1013
Aman,
It may help you: https://stackoverflow.com/a/55883490/7541412
Moreover, if you think PostgreSQL v10 can resolve your issues. You can try these commands:
sudo yum update -y
sudo amazon-linux-extras enable postgresql10
After having PostgreSQL in your repository, now you can install:
yum clean metadata
yum install postgresql
Thanks!
Upvotes: 17
Reputation: 2398
You can install PostgreSQL by running the following command:
$ sudo yum install postgresql postgresql-server postgresql-devel postgresql-contrib postgresql-docs
Out of curiosity why are you not using PostgreSQL on AWS RDS?
Upvotes: -3