码迷,mamicode.com
首页 > 编程语言 > 详细

<JAVA>Hadoop安装配置(单机)

时间:2015-08-05 18:22:16      阅读:231      评论:0      收藏:0      [点我收藏+]

标签:hadoop   ubuntu   vmware   java   

参考文献:

http://blog.csdn.net/inkfish/article/details/5168676

http://493663402-qq-com.iteye.com/blog/1515275

http://www.cnblogs.com/syveen/archive/2013/05/08/3068044.html

http://www.cnblogs.com/kinglau/p/3794433.html


环境 :Vmware11下Ubuntu14.04 LTS, Hadoop2.7.1


一 :创建账户

1.创建hadoop组 及组下hadoop用户 

dogless@ubuntu:~$ sudo addgroup hadoop 
dogless@ubuntu:~$ sudo adduser --ingroup hadoop hadoop

2.添加到sudoers里面  

dogless@ubuntu:~$ sudo gedit /etc/sudoers
如图  

技术分享

3.切换至hadoop用户

dogless@ubuntu:~$ su hadoop

二:安装配置SSH

1.从应用商店选择合适的源,比如阿里源

技术分享

2.安装 openssh-server

hadoop@ubuntu:/home/dogless$ sudo apt-get install openssh-server

3.启动ssh服务器

sudo /etc/init.d/ssh start
ps -e | grep ssh
4.修改为免密码登录

hadoop@ubuntu:/home/dogless$ ssh-keygen -t rsa -P '' -f ~/.ssh/id_rsa 
hadoop@ubuntu:/home/dogless$ cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys

5.尝试登录与登出,两遍

技术分享


三:安装JAVA

sudo apt-get install openjdk-7-jdk
技术分享

四:安装配置Hadoop(单机)

1.在桌面解压Hadoop 2.7.1安装包

技术分享

2.移动到/hadoop目录并赋予权限

hadoop@ubuntu:/home/dogless/Desktop$ sudo mv hadoop-2.7.1 /hadoop
hadoop@ubuntu:/home/dogless/Desktop$ sudo chmod 777 /hadoop

五:配置环境变量

hadoop@ubuntu:/home/dogless/Desktop$ sudo gedit /etc/profile
末尾追加  (特别注意JAVA_HOME和HADOOP_INSTALL路径)

#HADOOP
export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64
export JRE_HOME=$JAVA_HOME/jre
export CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH
export PATH=$JAVA_HOME/bin:$PATH:$JRE_HOME/lib
export HADOOP_INSTALL=/hadoop
export PATH=$PATH:$HADOOP_INSTALL/bin
export PATH=$PATH:$HADOOP_INSTALL/sbin
export HADOOP_MAPRED_HOME=$HADOOP_INSTALL
export HADOOP_COMMON_HOME=$HADOOP_INSTALL
export HADOOP_HDFS_HOME=$HADOOP_INSTALL
export YARN_HOME=$HADOOP_INSTALL
export HADOOP_COMMON_LIB_NATIVE_DIR=$HADOOP_INSTALL/lib/native
export HADOOP_OPTS="-Djava.library.path=$HADOOP_INSTALL/lib"
#HADOOP

更新环境

hadoop@ubuntu:/home/dogless/Desktop$ source /etc/profile

六:测试

1.定位到程序目录,创建测试目录input,使用Readme做数据

hadoop@ubuntu:/home/dogless/Desktop$ cd /hadoop
hadoop@ubuntu:/hadoop$ cp README.txt input

2.测试wordcount这个example,输出到output文件夹

hadoop@ubuntu:/hadoop$ bin/hadoop jar share/hadoop/mapreduce/hadoop-mapreduce-examples-2.7.1.jar wordcount input output

测试成功

技术分享



版权声明:本文为博主原创文章,未经博主允许不得转载。

<JAVA>Hadoop安装配置(单机)

标签:hadoop   ubuntu   vmware   java   

原文地址:http://blog.csdn.net/awsxsa/article/details/47299901

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!