日期:2014-05-17  浏览次数:20930 次

安装Apache Hadoop

1.系统(本人使用虚拟机):VMware-workstation-full-7.1.2-301548

?????????????????????????????????? ubuntu-10.10-desktop-i386?

?? 软件包:?jdk-6u31-linux-i586.bin

?????????????? hadoop-0.20.205.0.tar.gz

2.JDK安装:

?? 1)将jdk-6u31-linux-i586.bin复制到安装目录,比如:/usr/java/

???2)cd /usr/java

?? 3)chmod 777 jdk-6u31-linux-i586.bin

?? 4)./jdk-6u31-linux-i586.bin

???5)设置JAVA_HOME,vi /etc/profile

???6)在profile文件中加入:JAVA_HOME=/usr/java/jdk1.6.0_31

??????? PATH=$JAVA_HOME/bin:$PATH

??????? export JAVA_HOME PATH
???????????
?

???7)保存/etc/profile并退出,source /etc/profile

???8)执行java -version
??????


?3.Hadoop安装

??? 1)将hadoop-0.20.205.0.tar.gz复制到安装目录,比如:/usr

??? 2)cd /usr

??? 3)tar zxf hadoop-0.20.205.0.tar.gz

??? 4)进入hadoop的conf目录

??? 5)vi hadoop-evn.sh,将JAVA_HOME设置为JDK安装目录


??????????

??? 6)设置HADOOP_INSTALL环境变量,vi /etc/profile

??? 7)在profile中加入:HADOOP_INSTALL=/usr/hadoop-0.20.205.0

??????? PATH=$JAVA_HOME/bin:$HADOOP_INSTALL/bin:$PATH

??????? export JAVA_HOME? HADOOP_INSTALL PATH
???????????

??? 8)保存profile文件并退出,source?/etc/profile

????9)执行hadoop version

?

? 4.配置hadoop伪分布模式

???? 1)修改/config/core-site.xml

???????? <configuration> <property> <name>fs.default.name</name> <value>hdfs://localhost/</value> </property> </configuration>


?

??? 2)修改hdfs-site.xml

?

?

<configuration> <property> <name>dfs.replication</name> <value>1</value> </property> </configuration>


?

??? 3)修改mapred-site.xml

<configuration> <property> <name>mapred.job.tracker</name> <value>localhost:8021</value> </property> </configuration>


?

??? 4)创建一个基于空口令的SSH密钥,以启动无密码登录

??????? ssh-keygen -t rsa -P '' -f ~/.ssh/id_rsa

??????? cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys

??? 5)测试步骤4)是否成功,ssh localhost,如成功则无需键入密码

??? 6)格式化HDFS文件系统,hadoop namenode -format