This article address: http://www.cnblogs.com/archimedes/p/hadoop-standalone-mode.html, reprint please indicate source address.
I. Creating Hadoop groups and Hadoop users under Ubuntu
1. Create a Hadoop user group
sudo addgroup Hadoop
2. Create a Hadoop user
sudo adduser-ingroup hadoop Hadoop
You will be prompted to enter a new UNIX password, which is the password for the new user Hadoop, enter the return. If you do not enter a password, you will be prompted to enter the password again, that is, the password cannot be empty. Finally confirm the information is correct, if no problem, enter Y, carriage return.
3. Add Permissions for Hadoop users
Input:
sudo gedit/etc/sudoers
Enter, open the sudoers file and give the Hadoop user the same permissions as the root user
Two. Sign in to the Ubuntu system with the newly added Hadoop user
Three. Install SSH
sudo Install Openssh-server
After the installation is complete, start the service
sudo /etc/init.d/ssh start
To see if the service started correctly:
PS grep SSH
Setting up password-free logins, generating private and public keys
Ssh-keygen ""
Iv. installation of the Java environment
See the article "Installing JDK8 under Ubuntu 14.04"
V. Installation of hadoop2.5.1
1, official website download HTTP://MIRROR.BIT.EDU.CN/APACHE/HADOOP/COMMON/HADOOP-2.5.1/
2. Installation
Extract
sudo tar xzf hadoop-2.5. 1. tar. gz
If we're going to install Hadoop under/usr/local, the folder is Hadoop.
sudo MV hadoop-2.5. 1 /usr/local/hadoop
Give users read and write access to this folder
sudo chmod 774 /usr/local/hadoop
3. Configuration
1) configuration ~/.BASHRC
Before you configure this file, you need to know the Java installation path to set the JAVA_HOME environment variable, you can use the following command line to view the installation path
Update-alternatives--config Java
Configure the. bashrc file
sudo gedit ~/.BASHRC
Note: When entering this command, the following prompt may appear:
gtk-warning * *: Cannot open display:
Just turn off the terminal and reboot.
The command opens the edit window for the file, appends the following to the end of the file, and then saves and closes the editing window.
#HADOOP VARIABLES START
Export java_home=/opt/jdk1.8.0_20/
Export Hadoop_install=/usr/local/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 VARIABLES END
Execute the following to make the added environment variable effective:
SOURCE ~/.BASHRC
2) Edit/usr/local/hadoop/etc/hadoop/hadoop-env.sh
Execute the following command to open the edit window for the file
sudo gedit/usr/local/hadoop/etc/hadoop/hadoop-env. SH
Locate the Java_home variable and modify the variable as follows
Export JAVA_HOME=/OPT/JDK1.8.0_20
The modified hadoop-env.sh file resembles the following:
Displays some of the useful documentation for Hadoop:
Bin/hadoop
For example, you can use the following command to view the version information for Hadoop:
Hadoop version
Six. WordCount test
Stand-alone mode installation is complete, following the implementation of Hadoop's own instance wordcount verifying that the installation was successful
Create input folder under/usr/local/hadoop path
mkdir Input
Copy to input
CP Etc/hadoop/*. XML input
Perform
Bin/hadoop jar share/hadoop/mapreduce/hadoop-mapreduce-examples-2.5. 1 grep ' Dfs[a-z.] +'
Execution Result:
View output:
Resources:
1, "Ubuntu14.04 under the installation of Hadoop2.4.0 (stand-alone mode)"
2, Http://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-common/SingleCluster.html#Supported_Platforms
Install Hadoop2.5.1 under Ubuntu14.04 (stand-alone mode)