如何在 CentOS 上安装 Java SDK?

2022-01-08 00:00:00 centos sdk java

我有 CentOS 5,但我不知道安装 Java SDK 的步骤Linux.

I have CentOS 5, but I don't know the steps to install Java SDK on Linux.

在哪里下载 RPM 文件,接下来我该怎么做才能完全安装它?

Where to download the RPM file and what can I do next to fully install that?

然后我需要安装 Tomcat.

或者有没有现成的包供大家使用?

Or is there any ready-made package for all?

推荐答案

下面的命令会返回一个与Java直接相关的所有包的列表.它们的格式为 java-<version>.

The following command will return a list of all packages directly related to Java. They will be in the format of java-<version>.

$ yum search java | grep 'java-'

如果没有可用的软件包,那么您可能需要下载一个新的存储库进行搜索.我建议看一下 Dag Wieers' repo.下载后,再次尝试上述命令.

If there are no available packages, then you may need to download a new repository to search through. I suggest taking a look at Dag Wieers' repo. After downloading it, try the above command again.

您将看到至少一个可供下载的 Java 软件包版本.根据您阅读本文的时间,最新可用版本可能会有所不同.

You will see at least one version of Java packages available for download. Depending on when you read this, the lastest available version may be different.

java-1.7.0-openjdk.x86_64

仅上述软件包将仅安装 JRE.要同时安装 javac 和 JDK,以下命令可以解决问题:

The above package alone will only install JRE. To also install javac and JDK, the following command will do the trick:

$ yum install java-1.7.0-openjdk*

将安装这些包(以及它们的依赖项):

These packages will be installing (as well as their dependencies):

java-1.7.0-openjdk.x86_64
java-1.7.0-openjdk-accessibility.x86_64
java-1.7.0-openjdk-demo.x86_64
java-1.7.0-openjdk-devel.x86_64
java-1.7.0-openjdk-headless.x86_64
java-1.7.0-openjdk-javadoc.noarch
java-1.7.0-openjdk-src.x86_64

相关文章