由于依赖关系,在 EC2 上的 Amazon Linux 2 上安装 postgres 9.6 rpm 的 yum 安装失败

由于依赖关系,在 EC2 上的 Amazon Linux 2 上安装 postgres 9.6 rpm 的 yum 安装失败

由于依赖 /etc/redhat-release,在 EC2 上的 Amazon Linux 2 上安装 postgres 9.6 rpm 的 yum 失败

以下是日志

sudo yum install https://download.postgresql.org/pub/repos/yum/9.6/redhat/rhel-7-x86_64/pgdg-centos96-9.6-3.noarch.rpm

Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
pgdg-centos96-9.6-3.noarch.rpm                                                                                                                 | 5.6 kB  00:00:00     

Examining /var/tmp/yum-root-BrRLfO/pgdg-centos96-9.6-3.noarch.rpm: pgdg-redhat-repo-42.0-4.noarch

Marking /var/tmp/yum-root-BrRLfO/pgdg-centos96-9.6-3.noarch.rpm to be installed

Resolving Dependencies
--> Running transaction check
---> Package pgdg-redhat-repo.noarch 0:42.0-4 will be installed
--> Processing Dependency: /etc/redhat-release for package: pgdg-redhat-repo-42.0-4.noarch amzn2-core                                                                                                                                     | 2.4 kB  00:00:00     
--> 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-centos96-9.6-3.noarch)
           Requires: /etc/redhat-release

答案1

尝试sudo amazon-linux-extras

亚马逊有专门的渠道

https://aws.amazon.com/amazon-linux-2/faqs/#Amazon_Linux_Extras

答案2

https://techviewleo.com/install-postgresql-12-on-amazon-linux/

sudo yum -y update

sudo tee /etc/yum.repos.d/pgdg.repo<<EOF
[pgdg12]
name=PostgreSQL 12 for RHEL/CentOS 7 - x86_64
baseurl=https://download.postgresql.org/pub/repos/yum/12/redhat/rhel-7-x86_64
enabled=1
gpgcheck=0
EOF

sudo yum makecache

sudo yum install postgresql12 postgresql12-server

相关内容