Linux 安装 hadoop
1.下载安装包:
wget http://mirror.bit.edu.cn/apache/hadoop/common/hadoop-1.2.1/hadoop-1.2.1.tar.gz
2.移动到 opt 下
mv hadoop-1.2.1.tar.gz /opt/
3. 解压缩文件
tar -zxvf hadoop-1.2.1.tar.gz
4. 进入解压后的文件夹
root@ubuntu:/opt/hadoop-1.2.1/conf# ls capacity-scheduler.xml hadoop-policy.xml slaves configuration.xsl hdfs-site.xml ssl-client.xml.example core-site.xml log4j.properties ssl-server.xml.example fair-scheduler.xml mapred-queue-acls.xml taskcontroller.cfg hadoop-env.sh mapred-site.xml task-log4j.properties hadoop-metrics2.properties masters
5. 修改四个文件(hadoop-env.sh, core-site.xml, hdfs-site.xml, mapred-site.xml )
a) hadoop-env.sh 文件如下(通过 echo $JAVA_HOME 查看java 安装路径):
vim hadoop-env.sh
b) 修改 core-site.xml 文件(vim core-site.xml):
<configuration> <property> <name>hadoop.tmp.dir</name> <value>/hadoop</value> </property> <property> <name>dfs.tmp.dir</name> <value>/hadoop/name</value> </property> <property> <name>fs.default.name</name> <value>hdfs://ubuntu:9000</value> </property> </configuration>
c) 修改 hdfs-site.xml文件:
<configuration> <property> <name>dfs.data.dir</name> <value>/hadoop/data</value> </property> </configuration>
d) 修改mapred-site.xml
<configuration> <property> <name>mapred.job.tracker</name> <value>ubuntu:9001</value> </property> </configuration>
6. 告诉系统 hadoop的 安装路径:
vim /etc/profile
然后 source /etc/profile 使之生效
7.输入 hadoop 测试 是否生效
8. hadoop namenode -format 格式化文件系统
9. 输入 start-all.sh 启动 hadoop( 需要输入鉴权密码, 对应linux当前用户密码, 然后再输入hadoop 主机密码)
10. 输入 jps 查看当前进程如下说明hadoop正常运行: