https://www.oracle.com/java/technologies/downloads/#java8
#!/bin/bash
# 安装JDK
yum -y install jdk
# 配置JDK信息
if [ $(grep -c "# java jdk config" /etc/profile) == 0 ]; then
cat >> /etc/profile <<'EOF'
# java jdk config
JAVA_HOME=/usr/java/jdk1.8.0_231-amd64
PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH
CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/jre/lib/rt.jar
export JAVA_HOME PATH CLASSPATH
EOF
fi
报错
ed during initialization of VM
Unable to load native library: libnsl.so.1: cannot open shared object file: No such file or directory
缺啥库装啥库呗 yum install libnsl -y