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解壓結(jié)果
ls ../module/
jdk1.8.0_161
4.配置環(huán)境變量
sudo vim /etc/profile
按shift+g移到最后一行,然后增加2行配置,配置JAVA_HOME的環(huán)境變量
export JAVA_HOME=/opt/module/jdk1.8.0_161
export PATH=$PATH:$JAVA_HOME/bin
5.使環(huán)境變量的修改立即生效
source /etc/profile
6.驗(yàn)證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)