安装 openjdk 时 yum + 依赖关系不合逻辑

安装 openjdk 时 yum + 依赖关系不合逻辑

我们正在尝试安装java-1.8.0-openjdk-devel-1.8.0.161-2.b14.el7.x86_64.rpm

yum localinstall java-1.8.0-openjdk-devel-1.8.0.161-2.b14.el7.x86_64.rpm
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager
This system is registered to Red Hat Subscription Management, but is not receiving updates. You can use subscription-manager to assign subscriptions.
Examining java-1.8.0-openjdk-devel-1.8.0.161-2.b14.el7.x86_64.rpm: 1:java-1.8.0-openjdk-devel-1.8.0.161-2.b14.el7.x86_64
Marking java-1.8.0-openjdk-devel-1.8.0.161-2.b14.el7.x86_64.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package java-1.8.0-openjdk-devel.x86_64 1:1.8.0.161-2.b14.el7 will be installed
--> Processing Dependency: java-1.8.0-openjdk(x86-64) = 1:1.8.0.161-2.b14.el7 for package: 1:java-1.8.0-openjdk-devel-1.8.0.161-2.b14.el7.x86_64
--> Finished Dependency Resolution
Error: Package: 1:java-1.8.0-openjdk-devel-1.8.0.161-2.b14.el7.x86_64 (/java-1.8.0-openjdk-devel-1.8.0.161-2.b14.el7.x86_64)
           Requires: java-1.8.0-openjdk(x86-64) = 1:1.8.0.161-2.b14.el7
           Installed: 1:java-1.8.0-openjdk-1.8.0.171-8.b10.el7_5.x86_64 (installed)
               java-1.8.0-openjdk(x86-64) = 1:1.8.0.171-8.b10.el7_5
           Available: 1:java-1.8.0-openjdk-1.8.0.161-2.b14.el7.x86_64 (local)
               java-1.8.0-openjdk(x86-64) = 1:1.8.0.161-2.b14.el7
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest

我们可以从输出中看到:

 Requires: java-1.8.0-openjdk(x86-64) = 1:1.8.0.161-2.b14.el7

但我不明白的是,我们尝试安装所需的相同 rpm!

java-1.8.0-openjdk-devel-1.8.0.161-2.b14.el7.x86_64.rpm

那么这里发生了什么?

当前安装的rpm

rpm -qa | grep openjdk
java-1.8.0-openjdk-headless-1.8.0.171-8.b10.el7_5.x86_64
java-1.8.0-openjdk-1.8.0.171-8.b10.el7_5.x86_64

 java -version
openjdk version "1.8.0_171"
OpenJDK Runtime Environment (build 1.8.0_171-b10)
OpenJDK 64-Bit Server VM (build 25.171-b10, mixed mode)

安装它的唯一方法是通过 rpm (而不是通过 yum )

rpm -Va --nofiles --nodigest java-1.7.0-openjdk-devel-1.7.0.171-2.6.13.2.el7.x86_64.rpm

答案1

java-1.8.0-openjdk-devel并且java-1.8.0-openjdk版本需要完全匹配。

简而言之:

yum downgrade java-1.8.0-openjdk-1.8.0.161-2.b14.el7
yum install java-1.8.0-openjdk-devel-1.8.0.161-2.b14.el7.x86_64.rpm

我刚刚在这里写了这个问题的完整答案:https://stackoverflow.com/questions/57498755/installing-python36-devel-on-rhel7-failing/57519956#57519956

答案2

您可以尝试用以下方法修复它百胜下载器:

# Install yumdownloader
yum install yum-utils

# Download the missing packages
yumdownloader java-1.8.0-openjdk --resolve --destdir pkgs

# Install all at once
yum install pkgs/*.rpm

相关内容