1.安装JDK
- 解压到指定目录
[root@node1 opt]# ls
jdk-8u211-linux-x64.tar.gz redis-4.0.1
[root@node1 opt]# tar -zxvf jdk-8u211-linux-x64.tar.gz -C /usr/local/
[root@node1 opt]# cd /usr/local/
[root@node1 local]# ls
bin etc games include jdk1.8.0_211 lib lib64 libexec sbin share src
- 配置环境变量
[root@node1 local]# vim /etc/profile
JAVA_HOME=/usr/local/jdk1.8.0_211
CLASSPATH=.:$JAVA_HOME/lib/tools.jar
PATH=$JAVA_HOME/bin:$PATH
export PATH JAVA_HOME CLASSPAT
- 使配置文件生效
[root@node1 local]# source /etc/profile
- 查看版本
[root@node1 local]# java -version
java version "1.8.0_211"
Java(TM) SE Runtime Environment (build 1.8.0_211-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.211-b12, mixed mode)