- 查看云端目前支持安装的jdk版本
yum search java|grep jdk
[fangdake@Cent0S8-FTP pepCategory]$ yum search java|grep jdk CentOS Linux 8 - AppStream ? ? ? ? ? ? ? ? ? ? ?5.8 MB/s | 8.4 MB ? ? 00:01 ? ? CentOS Linux 8 - BaseOS ? ? ? ? ? ? ? ? ? ? ? ? 3.7 MB/s | 4.6 MB ? ? 00:01 ? ? CentOS Linux 8 - Extras ? ? ? ? ? ? ? ? ? ? ? ? ?13 kB/s | ?10 kB ? ? 00:00 ? ? java-1.8.0-openjdk.x86_64 : OpenJDK 8 Runtime Environment java-1.8.0-openjdk-accessibility.x86_64 : OpenJDK 8 accessibility connector java-1.8.0-openjdk-demo.x86_64 : OpenJDK 8 Demos java-1.8.0-openjdk-devel.x86_64 : OpenJDK 8 Development Environment java-1.8.0-openjdk-headless.x86_64 : OpenJDK 8 Headless Runtime Environment java-1.8.0-openjdk-headless-slowdebug.x86_64 : OpenJDK 8 Runtime Environment unoptimised with full debugging on java-1.8.0-openjdk-javadoc.noarch : OpenJDK 8 API documentation java-1.8.0-openjdk-javadoc-zip.noarch : OpenJDK 8 API documentation compressed in a single archive java-1.8.0-openjdk-slowdebug.x86_64 : OpenJDK 8 Runtime Environment unoptimised with full debugging on java-1.8.0-openjdk-src.x86_64 : OpenJDK 8 Source Bundle java-11-openjdk.x86_64 : OpenJDK 11 Runtime Environment java-11-openjdk-demo.x86_64 : OpenJDK 11 Demos java-11-openjdk-devel.x86_64 : OpenJDK 11 Development Environment java-11-openjdk-headless.x86_64 : OpenJDK 11 Headless Runtime Environment java-11-openjdk-javadoc.x86_64 : OpenJDK 11 API documentation java-11-openjdk-javadoc-zip.x86_64 : OpenJDK 11 API documentation compressed in a single archive java-11-openjdk-jmods.x86_64 : JMods for OpenJDK 11 java-11-openjdk-src.x86_64 : OpenJDK 11 Source Bundle java-11-openjdk-static-libs.x86_64 : OpenJDK 11 libraries for static linking java-17-openjdk.x86_64 : OpenJDK 17 Runtime Environment java-17-openjdk-demo.x86_64 : OpenJDK 17 Demos java-17-openjdk-devel.x86_64 : OpenJDK 17 Development Environment java-17-openjdk-headless.x86_64 : OpenJDK 17 Headless Runtime Environment java-17-openjdk-javadoc.x86_64 : OpenJDK 17 API documentation java-17-openjdk-javadoc-zip.x86_64 : OpenJDK 17 API documentation compressed in a single archive java-17-openjdk-jmods.x86_64 : JMods for OpenJDK 17 java-17-openjdk-src.x86_64 : OpenJDK 17 Source Bundle java-17-openjdk-static-libs.x86_64 : OpenJDK 17 libraries for static linking ?
2.安装JDK
我们选择一个版本的jdk去安装,命令如下:
yum install -y java-1.8.0-openjdk.x86_64
3.验证
java -version
?[fangdake@Cent0S8-FTP ~]$ java -version openjdk version "1.8.0_312" OpenJDK Runtime Environment (build 1.8.0_312-b07) OpenJDK 64-Bit Server VM (build 25.312-b07, mixed mode)
4.查看JDK安装目录
安装成功之后我们看看jdk的安装目录:
find / -name 'java'
可能会提示“权限不足”,此时需要在该命令前添加sudo即可,输入密码即可。即:
sudo find / -name 'java'
备注:通过yum命令在线安装jdk简单、快捷、无需配置环境变量即可使用java相关服务。
本文来源:
https://www.cnblogs.com/skychenjiajun/p/8177105.html
|