Linux 如何在 RHEL 中安装 java jdk?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5589396/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-05 03:34:33  来源:igfitidea点击:

How to install java jdk in RHEL?

linuxjavaredhat

提问by O_O

I am following example commands from other sites but it isn't helping!

我正在遵循来自其他站点的示例命令,但它没有帮助!

What am I doing wrong?

我究竟做错了什么?

chmod +x jdk-6u24-linux-i586-rpm.bin
./jdk-6u24-linux-i586-rpm.bin

Results give me:

结果给我:

bash: ./jdk-6u24-linux-i586-rpm.bin: /bin/sh: bad interpreter: Permission denied

Ok.. after doing

好的..做完之后

sh jdk-6u24-linux-i586-rpm.bin

as suggested below, I get this:

如下所示,我得到了这个:

enter image description here

在此处输入图片说明

Did the install fail? Is the file corrupted??? Thanks!!

安装失败了吗?文件损坏了吗???谢谢!!

采纳答案by uthark

Try to run it using sh itself, i.e

尝试使用 sh 本身运行它,即

sh jdk-6u24-linux-i586-rpm.bin

回答by Vipin

Please make sure you are doing correct.

请确保您的操作正确。

To install the Linux RPM (self-extracting) file Follow these instructions:

要安装 Linux RPM(自解压)文件,请遵循以下说明:

  1. Become the root user by running the su command and entering the super-user password. At the terminal: Type:

    su
    

    Enter the root password.

  2. Change to the directory in which you want to install. Type:

    cd <directory>
    

    For example, to install the software in the /usr/java/ directory, Type:

    cd /usr/java
    

    Note about root access: To install Java in a system-wide location such as/usr/local, you must login as the root user to gain the necessary permissions. If you do not have root access, install Java in your home directory or a subdirectory for which you have write permissions.

  3. Change the permission of the file you downloaded to be executable. Type:

    chmod a+x jre-6u<version>-linux-i586-rpm.bin
    
  4. Start the installation process. Type:

    ./jre-6u<version>-linux-i586-rpm.bin
    

    The license agreement is displayed. Review the agreement. Press the spacebar to display the next page. At the end, enter yes to proceed with the installation.

  5. The installation file creates and runs the file jre-6-linux-i586.rpm in the current directory.

    RPM unpacking completes

  6. Verify that the jre1.6.0_ sub-directory is listed under the current directory. Type:

    ls
    

    Verify the installation filename

  1. 通过运行 su 命令并输入超级用户密码成为 root 用户。在终端:输入:

    su
    

    输入根密码。

  2. 切换到要安装的目录。类型:

    cd <directory>
    

    例如,要在 /usr/java/ 目录中安装软件,请键入:

    cd /usr/java
    

    关于 root 访问的注意事项:要在系统范围的位置(例如 /usr/local)安装 Java,您必须以 root 用户身份登录以获得必要的权限。如果您没有 root 访问权限,请将 Java 安装在您的主目录或您具有写入权限的子目录中。

  3. 将您下载的文件的权限更改为可执行文件。类型:

    chmod a+x jre-6u<version>-linux-i586-rpm.bin
    
  4. 开始安装过程。类型:

    ./jre-6u<version>-linux-i586-rpm.bin
    

    显示许可协议。查看协议。按空格键显示下一页。最后,输入 yes 继续安装。

  5. 安装文件会在当前目录下创建并运行文件 jre-6-linux-i586.rpm。

    RPM 解包完成

  6. 验证当前目录下是否列出了 jre1.6.0_ 子目录。类型:

    ls
    

    验证安装文件名

Also refer: http://www.java.com/en/download/help/linux_install.xml#rpm

另请参阅:http: //www.java.com/en/download/help/linux_install.xml#rpm