ubuntu 上安装 hadoop

来源:互联网 发布:爱普生l360清零软件 编辑:程序博客网 时间:2024/05/16 09:05

1.下载hadoop

wget http://apache.cs.utah.edu/hadoop/common/hadoop-1.2.0/hadoop-1.2.0.tar.gz

解压缩

tar xvf hadoop-1.2.0.tar.gz hadoop

2.下载jdk

sudo apt-get install oracle-java7-installer


3.修改配置文件 /etc/environment

添加java环境变量

JAVA_HOME= "/usr/lib/jvm/java-1.6.0-openjdk/jre"export JAVA_HOME
添加hadoop路径
PATH = '...:/yumdir/hadoop/hadoop-1.2.0/bin'

4.修改hadoop配置文件

conf/hadoop-env.sh

变为

export JAVA_HOME=/usr/lib/jvm/java-6-sun

 conf/core-site.xml 添加

<property>  <name>hadoop.tmp.dir</name>  <value>/app/hadoop/tmp</value>  <description>A base for other temporary directories.</description></property> <property>  <name>fs.default.name</name>  <value>hdfs://localhost:54310</value>  <description>The name of the default file system.  A URI whose  scheme and authority determine the FileSystem implementation.  The  uri's scheme determines the config property (fs.SCHEME.impl) naming  the FileSystem implementation class.  The uri's authority is used to  determine the host, port, etc. for a filesystem.</description></property>
conf/mapred-site.xml
<property>  <name>mapred.job.tracker</name>  <value>localhost:54311</value>  <description>The host and port that the MapReduce job tracker runs  at.  If "local", then jobs are run in-process as a single map  and reduce task.  </description></property>

conf/hdfs-site.xml

添加

<property>  <name>dfs.replication</name>  <value>1</value>  <description>Default block replication.  The actual number of replications can be specified when the file is created.  The default is used if replication is not specified in create time.  </description></property>

5 安装ssh 因为hadoop namenode都是通过ssh连接

sudo apt-get install openssh-server



6.启动hadoop 

 start-all.sh 

如遇到不能使用root命令的时候 

sudo passwd 强制换成root


7. 安装结果

输入jps后得到如下信息

5433 NameNode
6380 Jps
5928 SecondaryNameNode
6014 JobTracker
5687 DataNode
6250 TaskTracker

表示安装成功

原创粉丝点击