I'm trying to install PostgreSQL 12 to launch a Rails app on AWS (EC2).

When I tried to install the devel file, I got the following error.

$sudo yum -y install postgresql12-devel
Plugins loaded: extras_suggestions, langpacks, priorities, update-motd
27 packages excluded due to repository priority protections
Resolving dependencies
->Performing transaction confirmation.
--->Install package postgresql12-devel.x86_64 0: 12.4-1PGDG.rhel7
->Dependency handling: llvm5.0-devel>= 5.0 package: postgresql12-devel-12.4-1PGDG.rhel7.x86_64
->Dependency handling: llvm-toolset-7-clang>= 4.0.1 package: postgresql12-devel-12.4-1PGDG.rhel7.x86_64
->Dependency resolution finished.
Error: Package: postgresql12-devel-12.4-1PGDG.rhel7.x86_64 (pgdg12)
             Request: llvm5.0-devel>= 5.0
Error: Package: postgresql12-devel-12.4-1PGDG.rhel7.x86_64 (pgdg12)
             Request: llvm-toolset-7-clang>= 4.0.1
 You can use --skip-broken to avoid the problem.
** Found 1 pre-existing rpmdb problem (s),'yum check' output follows:
pgdg-redhat-repo-42.0-12.noarch is missing the following request: /etc/redhat-release
What I tried

Until the installation of postgresql12 and postgresql12-server, I proceeded by referring to the following qiita article.
[Ansible] Install PostgreSQL 12 on Amazon Linux 2 and convert it to Ansible Playbook [PostgreSQL]

As you can see in this article, when installing the PostgreSQL yum repository on the OS, an error occurs because the/etc/redhat-release file does not exist, so I installed it with the "--nodeps" option.

$sudo rpm -ivh https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm

I thought that this was the place to focus on to solve the problem, but I didn't understand it because I was a beginner and lacked the prerequisite knowledge.

Since this is my first time to post a question on the question site, I think there may be some missing information, but thanks for your cooperation.

Supplementary information (FW/tool version, etc.)
  • Answer # 1

    It seems that postgresql12 is not officially supported in the Amazon Linux 2 repository yet, so installation is at your own risk.
    If you bring your own rpm and install it and you have a dependency problem, you have to fix it yourself.
    --nodepsAt the time of breaking the dependency, it is already in the category of self-responsibility.

    I tried it lightly at hand, but even if I could install postgresql and postgresql-server, I ended up trying some postgresql-devel.llvm-toolset-7-clang>= 4.0.1Could not resolve the dependency of.
    I think you can use it if you can solve it yourself.

    If PostgreSQL 11 is fine now
    sudo amazon-linux-extras install postgresql11I think that you can install it with, so if you do not need to be 12, I think that you should use that.
    When installing with amazon-linux-extras, the repository will also be enbaled at the same time, so you can install it by specifying postgresql-devel with yum after that.
    However, in reality
    Package postgresql-devel is obsoleted by libpq-devel, trying to install libpq-devel-11.5-1.amzn2.x86_64 instead
    Strictly speaking, it seems that something a little different will be included.