第一步:下载Hadoop1.0.3
在浏览器输入:http://apache.etoak.com/hadoop/common/hadoop-1.0.3/
选择hadoop-1.0.3.tar.gz
第二步:解压、配置环境变量
我将hadoop-1.0.3.tar.gz放置在了/Users/zhangosufei/software下。
利用命令:tar -zxvf hadoop-1.0.3.tar.gz解压,解压后的路径如下:
/Users/zhangosufei/software/hadoop-1.0.3
通过cd conf命令切换到conf,通过vi hadoop-env.sh,在此文件末尾输入一下命令:
- export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home
- export HADOOP_INSTALL=/Users/zhangosufei/software/hadoop-1.0.3
- export PATH=$PATH:$HADOOP_INSTALL/bin
保存,退出。
注意:HADOOP_INSTALL根据你本地hadoop所放置的位置来设置。
第三步:配置hadoop
通过vi core-site.xml,编辑此文件如下:
- <?xml version="1.0"?>
- <?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
- <!-- Put site-specific property overrides in this file. -->
- <configuration>
- <property>
- <name>fs.default.name</name>
- <value>hdfs://localhost:9000</value>
- </property>
- </configuration>
- <?xml version="1.0"?>
- <?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
- <!-- Put site-specific property overrides in this file. -->
- <configuration>
- <property>
- <name>mapred.job.tracker</name>
- <value>localhost:9001</value>
- </property>
- </configuration>
- <?xml version="1.0"?>
- <?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
- <!-- Put site-specific property overrides in this file. -->
- <configuration>
- <property>
- <name>dfs.replication</name>
- <value>1</value>
- </property>
- </configuration>