1. rpm file download
Download linkJava
SE 8 Archive Downloads (JDK 8u211 and later)
2. Upload to the server specified path and install
Switch to the upload directory and execute the following command
rpm -ivh jdk-8u221-linux-x64.rpm
3. Set environment variables and reload configuration
# 设置环境变量
vim /etc/profile
# 文件末尾添加,注意JAVA_HOME为安装路径
JAVA_HOME=/usr/java/jdk1.8.0_221-amd64:
CLASSPATH=.:$JAVA_HOME/lib.tools.jar
PATH=$JAVA_HOME/bin:$PATH
export JAVA_HOME CLASSPATH PATH
# 重新加载配置
source /etc/profile
4., and check if the installation is successful
java -version