1.创建目录/opt/apps
mkdir /opt/apps
2.将jdk-8u221-linux-x64.rpm上传apps下
3.安装jdk
rpm -ivh jdk-8u221-linux-x64.rpm
4.修改环境变量
vim /etc/profile export JAVA_HOME=/usr/java/default export PATH=$PATH:$JAVA_HOME/bin source /etc/profile
测试
[root@node1 apps]# java -version java version "1.8.0_221" Java(TM) SE Runtime Environment (build 1.8.0_221-b11) Java HotSpot(TM) 64-Bit Server VM (build 25.221-b11, mixed mode)