- 首先下载jdk_11.0.4.zip wget -c http://xxxxx/software/jdk-11.0.4.zip -P /opt
- 执行一下脚本安装(${your_directory}指的是你自己需要安装的目录)
#!/bin/sh
unzip /opt/jdk-11.0.4.zip -d /your_directory
cat << EOF >> ~/.bash_profile
export JAVA_HOME=/your_directory/jdk-11.0.4
export PATH=\$PATH:\${JAVA_HOME}/bin
EOF
cat << EOF >> /etc/profile
export JAVA_HOME=/your_directory/jdk-11.0.4
export PATH=\$PATH:\${JAVA_HOME}/bin
EOF
source /etc/profile
source /root/.bash_profile