您好,登录后才能下订单哦!
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进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。