您好,登錄后才能下訂單哦!
CentOS下
1、安裝linux
2、安裝jdk
[root@Cent0S1 ~]# javac //顯示信息
[root@Cent0S1 ~]# rpm -qa |grep jdk //查看是否有安裝包
[root@Cent0S1 ~]# which java //查看Java命令位置
/usr/bin/java
[root@Cent0S1 ~]# javac -version //查看Java版本
javac 1.8.0_191
[root@Cent0S1 ~]# ls -l /usr/bin/java //查看軟連接
lrwxrwxrwx. 1 root root 22 12月 27 15:09 /usr/bin/java -> /etc/alternatives/java
[root@Cent0S1 ~]# ls -l /etc/alternatives/java //查看jdk目錄
lrwxrwxrwx. 1 root root 73 12月 27 15:09 /etc/alternatives/java -> /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-1.el7_6.x86_64/jre/bin/java
[root@Cent0S1 ~]# find -name libjvm.so 2>/dev/null //查看jdk目錄方法2
/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.171-2.6.13.2.el7.x86_64/jre/lib/amd64/server/libjvm.so
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-1.el7_6.x86_64/jre/lib/amd64/server/libjvm.so
3、增加java環境變量
[root@Cent0S1 ~]# vi /etc/profile
export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-1.el7_6.x86_64/
export JRE_HOME=$JAVA_HOME/jre
export CLASSPARH=$JACA_HOME/lib:$JRE_HOME/lib:$CLASSPATH
export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH
[root@Cent0S1 ~]# source /etc/profile //環境生效
[root@Cent0S1 桌面]# mv hadoop-2.7.6 /opt
4、增加hadoop環境變量
[root@Cent0S1 hadoop]# pwd
/opt/hadoop-2.7.6/etc/hadoop
[root@Cent0S1 hadoop]vim hadoop-env.sh //修改JAVA_HOME
JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-1.el7_6.x86_64/
[root@Cent0S1 hadoop]# vim core-site.xml
<property>
<name>hadoop.tmp.dir</name>
<value>/hadoop</value>
</property>
<property>
<name>dfs.name.dir</name>
<value>/hadoop/name</value> #配置home路徑
</property>
<property>
<name>fs.default.name</name>
<value>hdfs://Cent0S1:9000</value> #Cent0S1為主機名稱
</property>
[root@Cent0S1 hadoop]#vim hdfs-site.xml
<property>
<name>dfs.name.dir</name>
<value>/hadoop/name</value> #配置home路徑
</property>
[root@Cent0S1 hadoop]# vim mapred-site.xml.template
<property>
<name>mapred.job.tracker</name>
<value>Cent0S1:9000</value>
</property>
[root@Cent0S1 ~]# vi /etc/profile
export HADOOP_HOME=/opt/hadoop-2.7.6
export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH:$HADOOP_HOME/bin
5、格式化hadoop namenode
[root@Cent0S1 bin]# hadoop namenode -format
[root@Cent0S1 sbin]# ./start-all.sh //開啟hadoop
[root@Cent0S1 sbin]# jps //檢查hadoop運行是否正常
22945 NameNode
23089 DataNode
23845 Jps
23430 ResourceManager
23722 NodeManager
23278 SecondaryNameNodeCentOS下
1、安裝linux
2、安裝jdk
[root@Cent0S1 ~]# javac //顯示信息
[root@Cent0S1 ~]# rpm -qa |grep jdk //查看是否有安裝包
[root@Cent0S1 ~]# which java //查看Java命令位置
/usr/bin/java
[root@Cent0S1 ~]# javac -version //查看Java版本
javac 1.8.0_191
[root@Cent0S1 ~]# ls -l /usr/bin/java //查看軟連接
lrwxrwxrwx. 1 root root 22 12月 27 15:09 /usr/bin/java -> /etc/alternatives/java
[root@Cent0S1 ~]# ls -l /etc/alternatives/java //查看jdk目錄
lrwxrwxrwx. 1 root root 73 12月 27 15:09 /etc/alternatives/java -> /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-1.el7_6.x86_64/jre/bin/java
[root@Cent0S1 ~]# find -name libjvm.so 2>/dev/null //查看jdk目錄方法2
/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.171-2.6.13.2.el7.x86_64/jre/lib/amd64/server/libjvm.so
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-1.el7_6.x86_64/jre/lib/amd64/server/libjvm.so
3、增加java環境變量
[root@Cent0S1 ~]# vi /etc/profile
export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-1.el7_6.x86_64/
export JRE_HOME=$JAVA_HOME/jre
export CLASSPARH=$JACA_HOME/lib:$JRE_HOME/lib:$CLASSPATH
export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH
[root@Cent0S1 ~]# source /etc/profile //環境生效
[root@Cent0S1 桌面]# mv hadoop-2.7.6 /opt
4、增加hadoop環境變量
[root@Cent0S1 hadoop]# pwd
/opt/hadoop-2.7.6/etc/hadoop
[root@Cent0S1 hadoop]vim hadoop-env.sh //修改JAVA_HOME
JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-1.el7_6.x86_64/
[root@Cent0S1 hadoop]# vim core-site.xml
<property>
<name>hadoop.tmp.dir</name>
<value>/hadoop</value>
</property>
<property>
<name>dfs.name.dir</name>
<value>/hadoop/name</value> #配置home路徑
</property>
<property>
<name>fs.default.name</name>
<value>hdfs://Cent0S1:9000</value> #Cent0S1為主機名稱
</property>
[root@Cent0S1 hadoop]#vim hdfs-site.xml
<property>
<name>dfs.name.dir</name>
<value>/hadoop/name</value> #配置home路徑
</property>
[root@Cent0S1 hadoop]# vim mapred-site.xml.template
<property>
<name>mapred.job.tracker</name>
<value>Cent0S1:9000</value>
</property>
[root@Cent0S1 ~]# vi /etc/profile
export HADOOP_HOME=/opt/hadoop-2.7.6
export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH:$HADOOP_HOME/bin
5、格式化hadoop namenode
[root@Cent0S1 bin]# hadoop namenode -format
[root@Cent0S1 sbin]# ./start-all.sh //開啟hadoop
[root@Cent0S1 sbin]# jps //檢查hadoop運行是否正常
22945 NameNode
23089 DataNode
23845 Jps
23430 ResourceManager
23722 NodeManager
23278 SecondaryNameNode
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。