Compiling hadoop2.4 in Linux
1. JDK Installation
...
Check whether the installation is successful in Java-version, Java, and javac.
2. Install Maven
...
Verify whether the installation is successful MVN-version
3. protobuf Installation
(0) install gcc
# Method 1: sudo apt-Get build-depgcc # Method 2: sudo apt-Get install build-essential # verify the installation: GCC -- version
(1) download
- Sudo wget https://protobuf.googlecode.com/files/protobuf-2.5.0.tar.gz
(2) installation:
Then go to the protobuf-2.5.0 folder and do the following:
$ sudo ./configure$ sudo make$ sudo make check$ sudo make install$ sudo ldconfig
(3) Verification
protoc --version
4. Install the OpenSSL library
- Sudo apt-Get install libssl-Dev
5. Install cmake
- Sudo apt-Get install cmake
6. Install ant
(1) first download ant
(2) Extract
- Tar zxvf apache-ant-1.9.4-bin.tar.gz
(3) Configure Environment Variables
Source/etc/profile
(4) check that the installation is successful
- Ant-version
Ii. Compile hadoop2.4The above preparations have already been completed.
Hadoop-src/Folder, enter the following command
mvn package -Pdist,native -DskipTests -Dtar
After waiting for more than 40 minutes, OK
In the directory ~ /Hadoop-2.4.0-src/hadoop-Dist/target file:
Hadoop-2.4.0.tar.gz
Summary:Here we need to add:
1. Error 1: cmake Is Not Installed
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.6:run (make) on project hadoop-common: An Ant BuildException hasoccured: Execute failed: java.io.IOException: Cannot run program "cmake" (indirectory "/home/wyf/hadoop-2.0.2-alpha-src/hadoop-common-project/hadoop-common/target/native"): java.io.IOException: error=2, No such file or directory-> [Help 1][ERROR][ERROR] To see the full stack trace of the errors, re-run Maven with the -eswitch.[ERROR] Re-run Maven using the -X switch to enable full debug logging.[ERROR][ERROR] For more information about the errors and possible solutions, pleaseread the following articles:[ERROR] [Help 1]http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
Solution:
Cmake Is Not Installed
- Sudo apt-Get install cmake
2. Error 2: ant is not installed
ERROR] Failed to execute goal org.codehaus.mojo.jspc:jspc-maven-plugin:2.0-alpha-3:compile (hdfs) on project hadoop-hdfs: Execution hdfs of goalorg.codehaus.mojo.jspc:jspc-maven-plugin:2.0-alpha-3:compile failed: Pluginorg.codehaus.mojo.jspc:jspc-maven-plugin:2.0-alpha-3 or one of its dependenciescould not be resolved: Could not transfer artifact ant:ant:jar:1.6.5 from/tocentral (http://repo.maven.apache.org/maven2): GET request of:ant/ant/1.6.5/ant-1.6.5.jar from central failed: Read timed out -> [Help 1][ERROR][ERROR] To see the full stack trace of the errors, re-run Maven with the -eswitch.[ERROR] Re-run Maven using the -X switch to enable full debug logging.[ERROR][ERROR] For more information about the errors and possible solutions, pleaseread the following articles:[ERROR] [Help 1]http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException[ERROR][ERROR] After correcting the problems, you can resume the build with the command[ERROR] mvn <goals> -rf :hadoop-hdfs
Solution:
Install ant.
3. protobuf version is too low and incorrect
[ERROR] Failed to execute goal org.apache.hadoop:hadoop-maven-plugins:2.4.0:protoc (compile-protoc) on project hadoop-common: org.apache.maven.plugin.MojoExecutionException: ‘protoc --version‘ did not return a version -> [Help 1][ERROR][ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.[ERROR] Re-run Maven using the -X switch to enable full debug logging.[ERROR][ERROR] For more information about the errors and possible solutions, please read the following articles:[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException[ERROR][ERROR] After correcting the problems, you can resume the build with the command[ERROR] mvn <goals> -rf :hadoop-common
The version corresponding to hadoop2.4 is the protobuf-2.5.0
Solution:
Follow the installation steps to install the protobuf-2.5.0
Hadoop2.4 source code compilation