/etc/profile后面添加以下四行
export HADOOP_HOME=/usr/hadoop/hadoop-2.7.4/
export JAVA_HOME=/usr/jdk64/jdk1.8.0_144/
export PATH=$PATH:$JAVA_HOME/bin/
export PATH=$PATH:$HADOOP_HOME/bin/
export PATH=$PATH:$HADOOP_HOME/sbin/
验证
[root@hadoop hadoop-2.7.4]# source /etc/profile
[root@hadoop hadoop-2.7.4]# java -version
java version "1.8.0_144"
Java(TM) SE Runtime Environment (build 1.8.0_144-b01)
Java HotSpot(TM) 64-Bit Server VM (build 25.144-b01, mixed mode)
[root@hadoop hadoop-2.7.4]# jps
10902 DataNode
10776 NameNode
11064 SecondaryNameNode
11339 Jps
[root@hadoop hadoop-2.7.4]# hadoop version
Hadoop 2.7.4
Subversion https://shv@git-wip-us.apache.org/repos/asf/hadoop.git -r cd915e1e8d9d0131462a0b7301586c175728a282
Compiled by kshvachk on 2017-08-01T00:29Z
Compiled with protoc 2.5.0
From source with checksum 50b0468318b4ce9bd24dc467b7ce1148
This command was run using /usr/hadoop/hadoop-2.7.4/share/hadoop/common/hadoop-common-2.7.4.jar
网友评论