如何在 CentOS-7 上安装 java-1.8.0-openjdk 和 java-1.8.0-openjdk-devel

如何在 CentOS-7 上安装 java-1.8.0-openjdk 和 java-1.8.0-openjdk-devel

我在 CentOS -7 上尝试安装 openjdk-1.8.0 (& -devel) 时似乎遇到了障碍,yum 无法找到该包(没有可用的包 java-1.8.0-openjdk。)

http://mirror.centos.org/centos/7/updates/x86_64/Packages/甚至不是从这里。

Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.tripadvisor.com
 * epel: s3-mirror-us-east-1.fedoraproject.org
 * extras: mirror.vtti.vt.edu
No package java-1.8.0-openjdk available.
Error: Nothing to do

CentOS-Base.repo:

[base]
name=CentOS-$releasever - Base
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#released updates 
[updates]
name=CentOS-$releasever - Updates
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus&infra=$infra
baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

更具体地说是 centos-release-7-4.1708.el7.centos.x86_64

答案1

yum search jdk

结果:

java-1.8.0-openjdk.x86_64 : OpenJDK Runtime Environment
java-1.8.0-openjdk-devel.x86_64 : OpenJDK Development Environment

因此你可以运行:

yum install java-1.8.0-openjdk.x86_64 java-1.8.0-openjdk-devel.x86_64

如果这不起作用,请尝试yum clean all并重复。


编辑:您还可以搜索您发布的 FTP repo 链接......

在此处输入图片描述

答案2

我估计

bash$ grep openjdk /etc/yum.conf
exclude=*.i?86 *openjdk* java*

并且不敢相信在其他所有事情上都花了很长时间。在删除排除项后现在可以工作了。非常天真!

答案3

根据以下输出,Java-1.8.0-openjdk似乎在更新

$ cat /etc/redhat-release 
CentOS Linux release 7.4.1708 (Core) 
$ yum list java-1.8.0-openjdk*
Loaded plugins: fastestmirror, langpacks, nvidia
Loading mirror speeds from cached hostfile
 * base: mirrors.tripadvisor.com
 * elrepo: repos.ord.lax-noc.com
 * epel: mirror.math.princeton.edu
 * extras: mirrors.greenmountainaccess.net
 * nux-dextop: mirror.li.nux.ro
 * updates: mirror.net.cen.ct.gov
Installed Packages
java-1.8.0-openjdk.x86_64                                                                                       1:1.8.0.144-0.b01.el7_4                                                                    @updates
java-1.8.0-openjdk-headless.x86_64                                                                              1:1.8.0.144-0.b01.el7_4                                                                    @updates
Available Packages
java-1.8.0-openjdk.i686                                                                                         1:1.8.0.144-0.b01.el7_4                                                                    updates 
java-1.8.0-openjdk-accessibility.i686                                                                           1:1.8.0.144-0.b01.el7_4                                                                    updates 
java-1.8.0-openjdk-accessibility.x86_64                                                                         1:1.8.0.144-0.b01.el7_4                                                                    updates 
java-1.8.0-openjdk-accessibility-debug.i686                                                                     1:1.8.0.144-0.b01.el7_4                                                                    updates 
java-1.8.0-openjdk-accessibility-debug.x86_64                                                                   1:1.8.0.144-0.b01.el7_4                                                                    updates 
java-1.8.0-openjdk-debug.i686                                                                                   1:1.8.0.144-0.b01.el7_4                                                                    updates 
java-1.8.0-openjdk-debug.x86_64                                                                                 1:1.8.0.144-0.b01.el7_4                                                                    updates 
java-1.8.0-openjdk-demo.i686                                                                                    1:1.8.0.144-0.b01.el7_4                                                                    updates 
java-1.8.0-openjdk-demo.x86_64                                                                                  1:1.8.0.144-0.b01.el7_4                                                                    updates 
java-1.8.0-openjdk-demo-debug.i686                                                                              1:1.8.0.144-0.b01.el7_4                                                                    updates 
java-1.8.0-openjdk-demo-debug.x86_64                                                                            1:1.8.0.144-0.b01.el7_4                                                                    updates 
java-1.8.0-openjdk-devel.i686                                                                                   1:1.8.0.144-0.b01.el7_4                                                                    updates 
java-1.8.0-openjdk-devel.x86_64                                                                                 1:1.8.0.144-0.b01.el7_4                                                                    updates 
java-1.8.0-openjdk-devel-debug.i686                                                                             1:1.8.0.144-0.b01.el7_4                                                                    updates 
java-1.8.0-openjdk-devel-debug.x86_64                                                                           1:1.8.0.144-0.b01.el7_4                                                                    updates 
java-1.8.0-openjdk-headless.i686                                                                                1:1.8.0.144-0.b01.el7_4                                                                    updates 
java-1.8.0-openjdk-headless-debug.i686                                                                          1:1.8.0.144-0.b01.el7_4                                                                    updates 
java-1.8.0-openjdk-headless-debug.x86_64                                                                        1:1.8.0.144-0.b01.el7_4                                                                    updates 
java-1.8.0-openjdk-javadoc.noarch                                                                               1:1.8.0.144-0.b01.el7_4                                                                    updates 
java-1.8.0-openjdk-javadoc-debug.noarch                                                                         1:1.8.0.144-0.b01.el7_4                                                                    updates 
java-1.8.0-openjdk-javadoc-zip.noarch                                                                           1:1.8.0.144-0.b01.el7_4                                                                    updates 
java-1.8.0-openjdk-javadoc-zip-debug.noarch                                                                     1:1.8.0.144-0.b01.el7_4                                                                    updates 
java-1.8.0-openjdk-src.i686                                                                                     1:1.8.0.144-0.b01.el7_4                                                                    updates 
java-1.8.0-openjdk-src.x86_64                                                                                   1:1.8.0.144-0.b01.el7_4                                                                    updates 
java-1.8.0-openjdk-src-debug.i686                                                                               1:1.8.0.144-0.b01.el7_4                                                                    updates 
java-1.8.0-openjdk-src-debug.x86_64                                                                             1:1.8.0.144-0.b01.el7_4                                                                    updates 
$ 

你应该跑yum 全部清理和/或yum 检查(需要一些时间)解决任何问题并重试...

相关内容