Reference Kinglau-Two, Ubuntu14.04 installation Hadoop2.4.0 (pseudo distribution mode)
Install Hadoop on Ubuntu (standalone)
1. Configure Core-site.xml
#hadoop1.x.x configuration files are under $HADOOP _home/conf/, hadoop2.x.x configuration files are under $HADOOP _home/etc/hadoop/
# This article will have been hadoop1.x.x as an example, hadoop2.x.x configuration of the corresponding file$ sudo gedit/usr/local/hadoop/conf/core-Site.xml#Add<configuration><properties><name>fs.default.name</name><value>hdfs://localhost:9000</value></properties>
<property>
<name>hadoop.tmp.dir</name>
<value>/usr/local/hadoop/tmp</value>
<description> Temp directory, parent directory for other temp directories </description>
<final>true</final>
</property>
</configuration>
2. Configure Hdfs-site.xml
<configuration><property><name>dfs.data.dir</name><value>/usr/local/hadoop/tmp/dfs/data</value><description>data node's data Catalog </description><final>true</final></property><property><name>dfs.name.dir</name><value>/usr/local/hadoop/tmp/dfs/name</value><description>name node meta-data </description><final>true</final></property><property><name>dfs.replication</name><value>1</value><description> Copy number of files </description></property></configuration>
3. Formatting Namenode
$/usr/local/hadoop/bin/hadoop Namenode-format
# when is asked "Re-format filesystem In/usr/local/hadoop/tmp/dfs/namenode? (Y or N) "Input y
# when you see something like "Storage Directory/usr/local/hadoop-1.2.1/tmp/dfs/name have been successfully formatted . ", you succeed.
4. Start Hadoop
$/usr/local/hadoop/bin/start-dfs.sh#starting Namenode, logging to/usr/local/hadoop/libexec/. /logs/hadoop-hadoop-namenode-erbin-ubuntu.out#localhost:starting Datanode, logging to/usr/local/hadoop/libexec/. /logs/hadoop-hadoop-datanode-erbin-ubuntu.out#localhost:starting Secondarynamenode, logging to/usr/local/hadoop/libexec/. /logs/hadoop-hadoop-secondarynamenode-erbin-ubuntu.out$ JPS-m#14841 DataNode#14983 Secondarynamenode#15073 jps-m#14701 NameNode
5. WordCount Test
$ cd/usr/local/Hadoop## Create a folder in HDFs$ bin/hadoop Dfs-mkdir/User$ bin/hadoop Dfs-ls/#drwxr-xr-x-hadoop supergroup 0 2015-04-24 15:08/user$ bin/hadoop dfs-mkdir/user/Hadoop## Hadoop will default to/user/hadoop as home$ Bin/hadoop DFS-mkdir Input$ Bin/hadoop DFS-ls#Found 1 Items#drwxr-xr-x-hadoop supergroup 0 2015-04-24 15:12/user/hadoop/input## Upload Local file value HDFs## Hadoop Dfs-put [local] [HDFs]$ Bin/hadoop DFS-put input input$ Bin/hadoop DFS-ls input#Found 7 Items#-rw-r--r--1 hadoop supergroup 7457 2015-04-24 15:12/user/hadoop/input/capacity-scheduler.xml#-rw-r--r--1 hadoop supergroup 178 2015-04-24 15:12/user/hadoop/input/core-site.xml#-rw-r--r--1 hadoop supergroup 327 2015-04-24 15:12/user/hadoop/input/fair-scheduler.xml#-rw-r--r--1 hadoop supergroup 4644 2015-04-24 15:12/user/hadoop/input/hadoop-policy.xml#-rw-r--r--1 hadoop supergroup 178 2015-04-24 15:12/user/hadoop/input/hdfs-site.xml#-rw-r--r--1 hadoop supergroup 2033 2015-04-24 15:12/user/hadoop/input/mapred-queue-acls.xml#-rw-r--r--1 hadoop supergroup 178 2015-04-24 15:12/user/hadoop/input/mapred-site.xml$ bin/hadoop Jar Hadoop-examples-1. X.x.jar wordcount Input Output$ Bin/hadoop DFS-ls Output#Found 2 Items#-rw-r--r--1 hadoop supergroup 0 2015-04-24 15:25/user/hadoop/output/_success#-rw-r--r--1 hadoop supergroup 6289 2015-04-24 15:25/user/hadoop/output/part-r-00000$ bin/hadoop Dfs-cat output/*
6. Turn off Hadoop
$/usr/local/hadoop-1.2.1/bin/stop-# stopping namenode# localhost:stopping datanode# Localhost:stopping secondarynamenode$ JPS-m# 15317 jps-m
7. Notes
Some articles, when configuring Core-site.xml,hdfs-site.xml, always add ' file:/' before the file path inside ' or ' file:///' . This notation is possible in 2.x, but in 1.x it is not possible to test the path that does not add the file prefix, in 1.x,2. x can be passed. If the Dfs.name.dir and Dfs.data.dir folders are implementation-created. Dfs.data.dir file permissions may error, if the error, just press the wrong way to change the permissions of the folder.
Ubuntu Install hadoop1.x (pseudo-distributed)