1.将jdk的linux安装包拷贝到centos
ls
hadoop-2.7.2.tar.gz jdk-8u161-linux-x64.tar.gz
2.将tar包解压到指定目录
tar -zxvf jdk-8u161-linux-x64.tar.gz -C /opt/module/
3.查看jdk解压结果
ls ../module/
jdk1.8.0_161
4.配置环境变量
sudo vim /etc/profile
按shift+g移到最后一行,然后增加2行配置,配置JAVA_HOME的环境变量
export JAVA_HOME=/opt/module/jdk1.8.0_161
export PATH=$PATH:$JAVA_HOME/bin
5.使环境变量的修改立即生效
source /etc/profile
6.验证jdk安装是否成功
[abc@linux200 software]$ source /etc/profile
[abc@linux200 software]$ java -version
java version "1.8.0_161"
Java(TM) SE Runtime Environment (build 1.8.0_161-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.161-b12, mixed mode)
网友评论