First, install the Java JDK
1.1 Here's a jdk1.7 download
Http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html
If the CPU is 32 bits, select Download Linux x86, if the CPU is 64 bits, select Download Linux x64. On this page, look for "Java SE development Kit 7u40", note that there is an option, you must select "Accept License agreement", accept License to download.
The downloaded jdk1.7 is stored in the "/home/chaofn/softwares" directory. (Mine is centos6.5)
The downloaded file is "java-jdk-7u40-linux-i586.tar.gz"
1.2 Unpack the JDK's tar package:
TAR-ZXVF /home/chaofn/softwares/java-jdk-7u40-linux-i586.tar.gz
Move the extracted files to the/home/chaofn/setup/directory
Mv/home/chaofn/softwares/jdk1.7.0_79/home/chaofn/setup
Second, configure the Java environment variables
2.1 Edit the/etc/profile file (must be the root user), add the following:
#JVAV
Export java_home=/home/chaofn/opt/setup/jdk1.7.0_79
Export path= $PATH: $JAVA _home/bin
Execute the following command: Source/etc/profile make it effective immediately
2.2 Testing
Command java-version
Show
Java Version "1.7.0_79"
Java (TM) SE Runtime Environment (build 1.7.0_79-b15)
Java HotSpot (TM) Client VM (build 24.79-b02, Mixed mode)
Indicates that the JDK environment variable is configured successfully
Third, install Hadoop
3.1 Download Hadoop, choose Stable version, in fact stable version is 1.2.1, download the site as follows:
Http://mirror.esocc.com/apache/hadoop/common/hadoop-1.2.1/
Download hadoop-1.2.1.tar.gz and store it in the "/home/chaofn/softwares" directory.
3.2 Extracting Hadoop
TAR-ZXVF /home/chaofn/softwares/hadoop-1.2.1.tar.gz then move to the/home/chaofn/setup/directory
3.3 Configuring the Hadoop environment variables
Edit/etc/profile File
#HADOOP
Export hadoop_home=/home/chaofn/opt/setup/hadoop-1.2.1
Export path= $PATH: $HADOOP _home/bin
Execute the following command: Source/etc/profile make it effective immediately
3.4 Test command Hadoop, display
Usage:hadoop [--config Confdir] COMMAND
Where COMMAND is one of:
...... Indicates a successful Hadoop configuration
Iv. Configuring the JDK installation path in Hadoop
There is a hadoop-env.sh file in the/home/chaofn/opt/setup/hadoop-1.2.1/conf directory
Edit the file, change the red box to mark the place
Set the Java_home path to its own installation path and save the exit
Here the Hadoop installation is basically complete.
Hadoop Environment Setup