我是靠谱客的博主 虚心鲜花,最近开发中收集的这篇文章主要介绍CentOS8下使用yum命令安装jdk,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

[root@node-etl-01 ~]# yum list java-1.8*   
Last metadata expiration check: 1:51:51 ago on Mon 01 Nov 2021 08:45:42 PM CST.
Available Packages
java-1.8.0-openjdk.x86_64                                                       1:1.8.0.312.b07-1.el8_4                                     appstream
java-1.8.0-openjdk-accessibility.x86_64                                         1:1.8.0.312.b07-1.el8_4                                     appstream
java-1.8.0-openjdk-demo.x86_64                                                  1:1.8.0.312.b07-1.el8_4                                     appstream
java-1.8.0-openjdk-devel.x86_64                                                 1:1.8.0.312.b07-1.el8_4                                     appstream
java-1.8.0-openjdk-headless.x86_64                                              1:1.8.0.312.b07-1.el8_4                                     appstream
java-1.8.0-openjdk-headless-slowdebug.x86_64                                    1:1.8.0.312.b07-1.el8_4                                     appstream
java-1.8.0-openjdk-javadoc.noarch                                               1:1.8.0.312.b07-1.el8_4                                     appstream
java-1.8.0-openjdk-javadoc-zip.noarch                                           1:1.8.0.312.b07-1.el8_4                                     appstream
java-1.8.0-openjdk-slowdebug.x86_64                                             1:1.8.0.312.b07-1.el8_4                                     appstream
java-1.8.0-openjdk-src.x86_64                                                   1:1.8.0.312.b07-1.el8_4                                     appstream
[root@node-etl-01 ~]# yum install java-1.8.0-openjdk* -y
Last metadata expiration check: 1:52:14 ago on Mon 01 Nov 2021 08:45:42 PM CST.
Dependencies resolved.
=====================================================================================================================================================
 Package                                            Architecture        Version                                         Repository              Size
=====================================================================================================================================================
[root@node-etl-01 jvm]# cat /etc/profile
# /etc/profile

# System wide environment and startup programs, for login setup
# Functions and aliases go in /etc/bashrc

# It's NOT a good idea to change this file unless you know what you
# are doing. It's much better to create a custom.sh shell script in
# /etc/profile.d/ to make custom changes to your environment, as this
# will prevent the need for merging in future updates.

pathmunge () {
    case ":${PATH}:" in
        *:"$1":*)
            ;;
        *)
            if [ "$2" = "after" ] ; then
                PATH=$PATH:$1
            else
                PATH=$1:$PATH
            fi
    esac
}


if [ -x /usr/bin/id ]; then
    if [ -z "$EUID" ]; then
        # ksh workaround
        EUID=`/usr/bin/id -u`
        UID=`/usr/bin/id -ru`
    fi
    USER="`/usr/bin/id -un`"
    LOGNAME=$USER
    MAIL="/var/spool/mail/$USER"
fi

# Path manipulation
if [ "$EUID" = "0" ]; then
    pathmunge /usr/sbin
    pathmunge /usr/local/sbin
else
    pathmunge /usr/local/sbin after
    pathmunge /usr/sbin after
fi

HOSTNAME=`/usr/bin/hostname 2>/dev/null`
HISTSIZE=1000
if [ "$HISTCONTROL" = "ignorespace" ] ; then
    export HISTCONTROL=ignoreboth
else
    export HISTCONTROL=ignoredups
fi

export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE HISTCONTROL

# By default, we want umask to get set. This sets it for login shell
# Current threshold for system reserved uid/gids is 200
# You could check uidgid reservation validity in
# /usr/share/doc/setup-*/uidgid file
if [ $UID -gt 199 ] && [ "`/usr/bin/id -gn`" = "`/usr/bin/id -un`" ]; then
    umask 002
else
    umask 022
fi

for i in /etc/profile.d/*.sh /etc/profile.d/sh.local ; do
    if [ -r "$i" ]; then
        if [ "${-#*i}" != "$-" ]; then 
            . "$i"
        else
            . "$i" >/dev/null
        fi
    fi
done

unset i
unset -f pathmunge

if [ -n "${BASH_VERSION-}" ] ; then
        if [ -f /etc/bashrc ] ; then
                # Bash login shells run only /etc/profile
                # Bash non-login shells run only /etc/bashrc
                # Check for double sourcing is done in /etc/bashrc.
                . /etc/bashrc
       fi
fi
export LC_ALL=en_US.UTF8
export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.312.b07-1.el8_4.x86_64
export JRE_HOME=$JAVA_HOME/jre
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib/rt.jar
export PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin

 

[root@node-etl-01 jvm]# source  /etc/profile
[root@node-etl-01 jvm]# 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)

最后

以上就是虚心鲜花为你收集整理的CentOS8下使用yum命令安装jdk的全部内容,希望文章能够帮你解决CentOS8下使用yum命令安装jdk所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(36)

评论列表共有 0 条评论

立即
投稿
返回
顶部