Linux使用yum安装JDK

Linux使用yum安装JDK

1、使用命令搜索JDK版本

yum search java|grep jdk

[root@VM-12-11-centos ~]# yum search java|grep jdk
ldapjdk-javadoc.noarch : Javadoc for ldapjdk
openjdk-asmtools-javadoc.noarch : Javadoc for openjdk-asmtools
java-1.6.0-openjdk.x86_64 : OpenJDK Runtime Environment
java-1.6.0-openjdk-demo.x86_64 : OpenJDK Demos
java-1.6.0-openjdk-devel.x86_64 : OpenJDK Development Environment
java-1.6.0-openjdk-javadoc.x86_64 : OpenJDK API Documentation
java-1.6.0-openjdk-src.x86_64 : OpenJDK Source Bundle
java-1.7.0-openjdk.x86_64 : OpenJDK Runtime Environment
java-1.7.0-openjdk-accessibility.x86_64 : OpenJDK accessibility connector
java-1.7.0-openjdk-demo.x86_64 : OpenJDK Demos
java-1.7.0-openjdk-devel.x86_64 : OpenJDK Development Environment
java-1.7.0-openjdk-headless.x86_64 : The OpenJDK runtime environment without
java-1.7.0-openjdk-javadoc.noarch : OpenJDK API Documentation
java-1.7.0-openjdk-src.x86_64 : OpenJDK Source Bundle
java-1.8.0-openjdk.i686 : OpenJDK Runtime Environment 8
java-1.8.0-openjdk.x86_64 : OpenJDK 8 Runtime Environment
java-1.8.0-openjdk-accessibility.i686 : OpenJDK accessibility connector
java-1.8.0-openjdk-accessibility.x86_64 : OpenJDK accessibility connector
java-1.8.0-openjdk-demo.i686 : OpenJDK Demos 8
java-1.8.0-openjdk-demo.x86_64 : OpenJDK 8 Demos
java-1.8.0-openjdk-devel.i686 : OpenJDK Development Environment 8
java-1.8.0-openjdk-devel.x86_64 : OpenJDK 8 Development Environment
java-1.8.0-openjdk-headless.i686 : OpenJDK Headless Runtime Environment 8
java-1.8.0-openjdk-headless.x86_64 : OpenJDK 8 Headless Runtime Environment
java-1.8.0-openjdk-javadoc.noarch : OpenJDK 8 API documentation
java-1.8.0-openjdk-javadoc-zip.noarch : OpenJDK 8 API documentation compressed
java-1.8.0-openjdk-src.i686 : OpenJDK Source Bundle 8
java-1.8.0-openjdk-src.x86_64 : OpenJDK 8 Source Bundle
java-11-openjdk.i686 : OpenJDK Runtime Environment 11
java-11-openjdk.x86_64 : OpenJDK 11 Runtime Environment
java-11-openjdk-demo.i686 : OpenJDK Demos 11
java-11-openjdk-demo.x86_64 : OpenJDK 11 Demos
java-11-openjdk-devel.i686 : OpenJDK Development Environment 11
java-11-openjdk-devel.x86_64 : OpenJDK 11 Development Environment
java-11-openjdk-headless.i686 : OpenJDK Headless Runtime Environment 11
java-11-openjdk-headless.x86_64 : OpenJDK 11 Headless Runtime Environment
java-11-openjdk-javadoc.i686 : OpenJDK 11 API documentation
java-11-openjdk-javadoc.x86_64 : OpenJDK 11 API documentation
java-11-openjdk-javadoc-zip.i686 : OpenJDK 11 API documentation compressed in a
java-11-openjdk-javadoc-zip.x86_64 : OpenJDK 11 API documentation compressed in
java-11-openjdk-jmods.i686 : JMods for OpenJDK 11
java-11-openjdk-jmods.x86_64 : JMods for OpenJDK 11
java-11-openjdk-src.i686 : OpenJDK Source Bundle 11
java-11-openjdk-src.x86_64 : OpenJDK 11 Source Bundle
java-11-openjdk-static-libs.i686 : OpenJDK libraries for static linking 11
java-11-openjdk-static-libs.x86_64 : OpenJDK 11 libraries for static linking
java-latest-openjdk.x86_64 : OpenJDK 17 Runtime Environment
java-latest-openjdk-debug.x86_64 : OpenJDK 17 Runtime Environment with full
java-latest-openjdk-demo.x86_64 : OpenJDK 17 Demos
java-latest-openjdk-demo-debug.x86_64 : OpenJDK 17 Demos with full debugging on
java-latest-openjdk-demo-fastdebug.x86_64 : OpenJDK 17 Demos with minimal
java-latest-openjdk-devel.x86_64 : OpenJDK 17 Development Environment
java-latest-openjdk-devel-debug.x86_64 : OpenJDK 17 Development Environment with
java-latest-openjdk-devel-fastdebug.x86_64 : OpenJDK 17 Development Environment
java-latest-openjdk-fastdebug.x86_64 : OpenJDK 17 Runtime Environment with
java-latest-openjdk-headless.x86_64 : OpenJDK 17 Headless Runtime Environment
java-latest-openjdk-headless-debug.x86_64 : OpenJDK 17 Runtime Environment with
java-latest-openjdk-headless-fastdebug.x86_64 : OpenJDK 17 Runtime Environment
java-latest-openjdk-javadoc.x86_64 : OpenJDK 17 API documentation
java-latest-openjdk-javadoc-zip.x86_64 : OpenJDK 17 API documentation compressed
java-latest-openjdk-jmods.x86_64 : JMods for OpenJDK 17
java-latest-openjdk-jmods-debug.x86_64 : JMods for OpenJDK 17 with full
java-latest-openjdk-jmods-fastdebug.x86_64 : JMods for OpenJDK 17 with minimal
java-latest-openjdk-src.x86_64 : OpenJDK 17 Source Bundle
java-latest-openjdk-src-debug.x86_64 : OpenJDK 17 Source Bundle for packages
java-latest-openjdk-src-fastdebug.x86_64 : OpenJDK 17 Source Bundle
java-latest-openjdk-static-libs.x86_64 : OpenJDK 17 libraries for static linking
java-latest-openjdk-static-libs-debug.x86_64 : OpenJDK 17 libraries for static
java-latest-openjdk-static-libs-fastdebug.x86_64 : OpenJDK 17 libraries for
ldapjdk.noarch : The Mozilla LDAP Java SDK
openjdk-asmtools.noarch : To develop tools create proper & improper Java

2、选择版本进行安装

yum install -y java-11-openjdk-static-libs.x86_64

[root@VM-12-11-centos ~]# yum install -y java-11-openjdk-static-libs.x86_64
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
Resolving Dependencies
–> Running transaction check
—> Package java-11-openjdk-static-libs.x86_64 1:11.0.13.0.8-1.el7_9 will be installed
–> Processing Dependency: java-11-openjdk-devel(x86-64) = 1:11.0.13.0.8-1.el7_9 for package: 1:java-11-openjdk-static-libs-11.0.13.0.8-1.el7_9.x86_64
–> Running transaction check
—> Package java-11-openjdk-devel.x86_64 1:11.0.13.0.8-1.el7_9 will be installed
–> Processing Dependency: java-11-openjdk(x86-64) = 1:11.0.13.0.8-1.el7_9 for package: 1:java-11-openjdk-devel-11.0.13.0.8-1.el7_9.x86_64
–> Running transaction check
—> Package java-11-openjdk.x86_64 1:11.0.13.0.8-1.el7_9 will be installed
–> Processing Dependency: java-11-openjdk-headless(x86-64) = 1:11.0.13.0.8-1.el7_9 for package: 1:java-11-openjdk-11.0.13.0.8-1.el7_9.x86_64
–> Processing Dependency: xorg-x11-fonts-Type1 for package: 1:java-11-openjdk-11.0.13.0.8-1.el7_9.x86_64
–> Processing Dependency: libjvm.so()(64bit) for package: 1:java-11-openjdk-11.0.13.0.8-1.el7_9.x86_64
–> Processing Dependency: libjava.so()(64bit) for package: 1:java-11-openjdk-11.0.13.0.8-1.el7_9.x86_64
–> Processing Dependency: libgif.so.4()(64bit) for package: 1:java-11-openjdk-11.0.13.0.8-1.el7_9.x86_64
–> Processing Dependency: libXtst.so.6()(64bit) for package: 1:java-11-openjdk-11.0.13.0.8-1.el7_9.x86_64
–> Running transaction check
—> Package giflib.x86_64 0:4.1.6-9.el7 will be installed
–> Processing Dependency: libSM.so.6()(64bit) for package: giflib-4.1.6-9.el7.x86_64
–> Processing Dependency: libICE.so.6()(64bit) for package: giflib-4.1.6-9.el7.x86_64
—> Package java-11-openjdk-headless.x86_64 1:11.0.13.0.8-1.el7_9 will be installed
–> Processing Dependency: tzdata-java >= 2020f for package: 1:java-11-openjdk-headless-11.0.13.0.8-1.el7_9.x86_64
–> Processing Dependency: copy-jdk-configs >= 3.3 for package: 1:java-11-openjdk-headless-11.0.13.0.8-1.el7_9.x86_64
–> Processing Dependency: pcsc-lite-libs(x86-64) for package: 1:java-11-openjdk-headless-11.0.13.0.8-1.el7_9.x86_64
–> Processing Dependency: lksctp-tools(x86-64) for package: 1:java-11-openjdk-headless-11.0.13.0.8-1.el7_9.x86_64
–> Processing Dependency: javapackages-tools for package: 1:java-11-openjdk-headless-11.0.13.0.8-1.el7_9.x86_64
—> Package libXtst.x86_64 0:1.2.3-1.el7 will be installed
—> Package xorg-x11-fonts-Type1.noarch 0:7.5-9.el7 will be installed
–> Processing Dependency: ttmkfdir for package: xorg-x11-fonts-Type1-7.5-9.el7.noarch
–> Processing Dependency: ttmkfdir for package: xorg-x11-fonts-Type1-7.5-9.el7.noarch
–> Processing Dependency: mkfontdir for package: xorg-x11-fonts-Type1-7.5-9.el7.noarch
–> Processing Dependency: mkfontdir for package: xorg-x11-fonts-Type1-7.5-9.el7.noarch
–> Running transaction check
—> Package copy-jdk-configs.noarch 0:3.3-10.el7_5 will be installed
—> Package javapackages-tools.noarch 0:3.4.1-11.el7 will be installed
–> Processing Dependency: python-javapackages = 3.4.1-11.el7 for package: javapackages-tools-3.4.1-11.el7.noarch
–> Processing Dependency: libxslt for package: javapackages-tools-3.4.1-11.el7.noarch
—> Package libICE.x86_64 0:1.0.9-9.el7 will be installed
—> Package libSM.x86_64 0:1.2.2-2.el7 will be installed
—> Package lksctp-tools.x86_64 0:1.0.17-2.el7 will be installed
—> Package pcsc-lite-libs.x86_64 0:1.8.8-8.el7 will be installed
—> Package ttmkfdir.x86_64 0:3.0.9-42.el7 will be installed
—> Package tzdata-java.noarch 0:2021e-1.el7 will be installed
—> Package xorg-x11-font-utils.x86_64 1:7.5-21.el7 will be installed
–> Processing Dependency: libfontenc.so.1()(64bit) for package: 1:xorg-x11-font-utils-7.5-21.el7.x86_64
–> Running transaction check
—> Package libfontenc.x86_64 0:1.1.3-3.el7 will be installed
—> Package libxslt.x86_64 0:1.1.28-6.el7 will be installed
—> Package python-javapackages.noarch 0:3.4.1-11.el7 will be installed
–> Processing Dependency: python-lxml for package: python-javapackages-3.4.1-11.el7.noarch
–> Running transaction check
—> Package python-lxml.x86_64 0:3.2.1-4.el7 will be installed
–> Finished Dependency Resolution

Dependencies Resolved

================================================================================================================================================================================================================================================================================================================================================================================================================

Package Arch Version Repository Size

Installing:
java-11-openjdk-static-libs x86_64 1:11.0.13.0.8-1.el7_9 updates 15 M
Installing for dependencies:
copy-jdk-configs noarch 3.3-10.el7_5 os 21 k
giflib x86_64 4.1.6-9.el7 os 40 k
java-11-openjdk x86_64 1:11.0.13.0.8-1.el7_9 updates 233 k
java-11-openjdk-devel x86_64 1:11.0.13.0.8-1.el7_9 updates 3.4 M
java-11-openjdk-headless x86_64 1:11.0.13.0.8-1.el7_9 updates 39 M
javapackages-tools noarch 3.4.1-11.el7 os 73 k
libICE x86_64 1.0.9-9.el7 os 66 k
libSM x86_64 1.2.2-2.el7 os 39 k
libXtst x86_64 1.2.3-1.el7 os 20 k
libfontenc x86_64 1.1.3-3.el7 os 31 k
libxslt x86_64 1.1.28-6.el7 os 242 k
lksctp-tools x86_64 1.0.17-2.el7 os 88 k
pcsc-lite-libs x86_64 1.8.8-8.el7 os 34 k
python-javapackages noarch 3.4.1-11.el7 os 31 k
python-lxml x86_64 3.2.1-4.el7 os 758 k
ttmkfdir x86_64 3.0.9-42.el7 os 48 k
tzdata-java noarch 2021e-1.el7 updates 190 k
xorg-x11-font-utils x86_64 1:7.5-21.el7 os 104 k
xorg-x11-fonts-Type1 noarch 7.5-9.el7 os 521 k

Transaction Summary

Install 1 Package (+19 Dependent packages)

Total download size: 60 M
Installed size: 287 M
Downloading packages:
(1/20): copy-jdk-configs-3.3-10.el7_5.noarch.rpm | 21 kB 00:00:00
(2/20): giflib-4.1.6-9.el7.x86_64.rpm | 40 kB 00:00:00
(3/20): java-11-openjdk-11.0.13.0.8-1.el7_9.x86_64.rpm | 233 kB 00:00:00
(4/20): java-11-openjdk-devel-11.0.13.0.8-1.el7_9.x86_64.rpm | 3.4 MB 00:00:01
(5/20): javapackages-tools-3.4.1-11.el7.noarch.rpm | 73 kB 00:00:00
(6/20): libICE-1.0.9-9.el7.x86_64.rpm | 66 kB 00:00:00
(7/20): libSM-1.2.2-2.el7.x86_64.rpm | 39 kB 00:00:00
(8/20): libXtst-1.2.3-1.el7.x86_64.rpm | 20 kB 00:00:00
(9/20): libfontenc-1.1.3-3.el7.x86_64.rpm | 31 kB 00:00:00
(10/20): lksctp-tools-1.0.17-2.el7.x86_64.rpm | 88 kB 00:00:00
(11/20): pcsc-lite-libs-1.8.8-8.el7.x86_64.rpm | 34 kB 00:00:00
(12/20): libxslt-1.1.28-6.el7.x86_64.rpm | 242 kB 00:00:00
(13/20): python-javapackages-3.4.1-11.el7.noarch.rpm | 31 kB 00:00:00
(14/20): ttmkfdir-3.0.9-42.el7.x86_64.rpm | 48 kB 00:00:00
(15/20): python-lxml-3.2.1-4.el7.x86_64.rpm | 758 kB 00:00:00
(16/20): java-11-openjdk-headless-11.0.13.0.8-1.el7_9.x86_64.rpm | 39 MB 00:00:02
(17/20): java-11-openjdk-static-libs-11.0.13.0.8-1.el7_9.x86_64.rpm | 15 MB 00:00:02
(18/20): tzdata-java-2021e-1.el7.noarch.rpm | 190 kB 00:00:00
(19/20): xorg-x11-font-utils-7.5-21.el7.x86_64.rpm | 104 kB 00:00:00

(20/20): xorg-x11-fonts-Type1-7.5-9.el7.noarch.rpm | 521 kB 00:00:00

Total 15 MB/s | 60 MB 00:00:03
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : libICE-1.0.9-9.el7.x86_64 1/20
Installing : libxslt-1.1.28-6.el7.x86_64 2/20
Installing : python-lxml-3.2.1-4.el7.x86_64 3/20
Installing : python-javapackages-3.4.1-11.el7.noarch 4/20
Installing : javapackages-tools-3.4.1-11.el7.noarch 5/20
Installing : libSM-1.2.2-2.el7.x86_64 6/20
Installing : giflib-4.1.6-9.el7.x86_64 7/20
Installing : copy-jdk-configs-3.3-10.el7_5.noarch 8/20
Installing : lksctp-tools-1.0.17-2.el7.x86_64 9/20
Installing : libfontenc-1.1.3-3.el7.x86_64 10/20
Installing : 1:xorg-x11-font-utils-7.5-21.el7.x86_64 11/20
Installing : tzdata-java-2021e-1.el7.noarch 12/20
Installing : pcsc-lite-libs-1.8.8-8.el7.x86_64 13/20
Installing : 1:java-11-openjdk-headless-11.0.13.0.8-1.el7_9.x86_64 14/20
Installing : libXtst-1.2.3-1.el7.x86_64 15/20
Installing : ttmkfdir-3.0.9-42.el7.x86_64 16/20
Installing : xorg-x11-fonts-Type1-7.5-9.el7.noarch 17/20
Installing : 1:java-11-openjdk-11.0.13.0.8-1.el7_9.x86_64 18/20
Installing : 1:java-11-openjdk-devel-11.0.13.0.8-1.el7_9.x86_64 19/20
Installing : 1:java-11-openjdk-static-libs-11.0.13.0.8-1.el7_9.x86_64 20/20
Verifying : 1:java-11-openjdk-headless-11.0.13.0.8-1.el7_9.x86_64 1/20
Verifying : 1:java-11-openjdk-11.0.13.0.8-1.el7_9.x86_64 2/20
Verifying : 1:xorg-x11-font-utils-7.5-21.el7.x86_64 3/20
Verifying : libxslt-1.1.28-6.el7.x86_64 4/20
Verifying : libICE-1.0.9-9.el7.x86_64 5/20
Verifying : giflib-4.1.6-9.el7.x86_64 6/20
Verifying : xorg-x11-fonts-Type1-7.5-9.el7.noarch 7/20
Verifying : libSM-1.2.2-2.el7.x86_64 8/20
Verifying : python-javapackages-3.4.1-11.el7.noarch 9/20
Verifying : ttmkfdir-3.0.9-42.el7.x86_64 10/20
Verifying : 1:java-11-openjdk-static-libs-11.0.13.0.8-1.el7_9.x86_64 11/20
Verifying : python-lxml-3.2.1-4.el7.x86_64 12/20
Verifying : libXtst-1.2.3-1.el7.x86_64 13/20
Verifying : pcsc-lite-libs-1.8.8-8.el7.x86_64 14/20
Verifying : javapackages-tools-3.4.1-11.el7.noarch 15/20
Verifying : tzdata-java-2021e-1.el7.noarch 16/20
Verifying : libfontenc-1.1.3-3.el7.x86_64 17/20
Verifying : lksctp-tools-1.0.17-2.el7.x86_64 18/20
Verifying : copy-jdk-configs-3.3-10.el7_5.noarch 19/20
Verifying : 1:java-11-openjdk-devel-11.0.13.0.8-1.el7_9.x86_64 20/20

Installed:
java-11-openjdk-static-libs.x86_64 1:11.0.13.0.8-1.el7_9

Dependency Installed:
copy-jdk-configs.noarch 0:3.3-10.el7_5 giflib.x86_64 0:4.1.6-9.el7 java-11-openjdk.x86_64 1:11.0.13.0.8-1.el7_9 java-11-openjdk-devel.x86_64 1:11.0.13.0.8-1.el7_9 java-11-openjdk-headless.x86_64 1:11.0.13.0.8-1.el7_9 javapackages-tools.noarch 0:3.4.1-11.el7 libICE.x86_64 0:1.0.9-9.el7 libSM.x86_64 0:1.2.2-2.el7
libXtst.x86_64 0:1.2.3-1.el7 libfontenc.x86_64 0:1.1.3-3.el7 libxslt.x86_64 0:1.1.28-6.el7 lksctp-tools.x86_64 0:1.0.17-2.el7 pcsc-lite-libs.x86_64 0:1.8.8-8.el7 python-javapackages.noarch 0:3.4.1-11.el7 python-lxml.x86_64 0:3.2.1-4.el7 ttmkfdir.x86_64 0:3.0.9-42.el7
tzdata-java.noarch 0:2021e-1.el7 xorg-x11-font-utils.x86_64 1:7.5-21.el7 xorg-x11-fonts-Type1.noarch 0:7.5-9.el7

Complete!

3、测试是否安装成功

java -version

[root@VM-12-11-centos ~]# java -version
openjdk version “11.0.13” 2021-10-19 LTS
OpenJDK Runtime Environment 18.9 (build 11.0.13+8-LTS)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.13+8-LTS, mixed mode, sharing)

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值