1.安装ssh
输入命令:
sudo apt-get install openssh-server  
 
配置ssh无密码登录
输入命令:
 
su - hadoop  
 
ssh-keygen -trsa -P ""  
 
cp ~/.ssh/id_rsa.pub ~/.ssh/authorized_keys
之后输入
ssh localhost  
 查看配置情况
成功的话应该有以下输出:
Linux ubuntu 2.6.35-27-generic #48-Ubuntu SMP Tue Feb 22 20:25:29 UTC 2011 i686 GNU/Linux
 Ubuntu 10.10
 
2.配置hadoop文件 
 
共有四个文件需要配置
分别是分别是core-site.xml,hadoop-env.sh,hdsf-site.xml和mapred-site.xml
配置core-site.xml:
<?xml version="1.0"?>
 <?xml-stylesheet type="text/xsl"href="configuration.xsl"?>
 <!-- Put site-specific property overrides in thisfile. -->
 <configuration>
  <property>
    <name>fs.default.name</name>
   <value>hdfs://localhost:9000</value>
  </property>
  <property>
    <name>hadoop.tmp.dir</name>
    <value>/home/hadoop/program/tmp-${user.name}</value>
   </property>
 </configuration>
 
配置hadoop-env.sh
只需要配置java路径,我用ubuntu自带的openjdk,路径如下:
export JAVA_HOME=/usr/jvm/openjdk1.6.0 
 
配置hdsf-site.xml
<?xml version="1.0"?>
 <?xml-stylesheet type="text/xsl"href="configuration.xsl"?>
 <!-- Put site-specific property overrides in thisfile. -->
 <configuration>
     <property>
         <name>dfs.replication</name>
         <value>1</value>
     </property>
 </configuration>
 
配置mapred-site.xml
<?xml version="1.0"?>
 <?xml-stylesheet type="text/xsl"href="configuration.xsl"?>
 <!-- Put site-specific property overrides in thisfile. -->
 <configuration>
     <property>
        <name>mapred.job.tracker</name>
        <value>localhost:9001</value>
     </property>
 </configuration>
 
 
3运行Hadoop
(1)格式化namenode
 
进入hadoop安装目录下,输入:
bin/hadoop namenode –format 
 
正常的话会有如下信息:
10/05/08 16:59:56 INFO namenode.NameNode: STARTUP_MSG: 
  /*******************************