Hamawhite (qq:530422429) original works, reproduced please specify the source : http://write.blog.csdn.net/postedit/40615469.
1. The installation environment is described as follows:
System: Ubuntu14.04
Hadoop version: hadoop-2.5.0 (click to download)
Java version: openjdk-1.7.0_55
Eclipse version: Release 4.4.0 (click to download)
2. Extract the download Hadoop source package hadoop-2.5.0-src.tar.gz to the working directory (this is/home/baisong),
Get the Hadoop-2.5.0-src folder.
3. Install MAVEN with the following command:
$ sudo apt-get install maven
4. Install the Google Open Source serialization framework Protocol buffers.
1) Download protobuf-2.5.0.tar.gz (click to download), then unzip to get protobuf-2.5.0 folder.
2) Enter protobuf-2.5.0, input subordinate command:
$./configure
Encountered the following error:
Analysis: This is a common Ubuntu error, you can download all the common library, the command is as follows:
$ sudo apt-get install build-essential
And then enter$./configure command.
3) Execute the following three commands sequentially.
$ Make
$ make Check
$ sudo make install
4) Check the protocol version number to see if the installation was successful.
$ protoc--version
encountered the following error, as follows:
The analysis is because the system cannot find the Lib library, modify the/etc/ld.so.conf file, and add/usr/local/lib. As follows:
$ sudo gedit/etc/ld.so.conf
content: Include/etc/ld.so.conf.d/*.conf/usr/local/lib
update the library file path by executing the following command, and then you can view the version number by using the $ protoc--version command.
$ sudo ldconfig
5. Compile the Hadoop source code to generate the jar package, without compiling native code, test case and generate document, under the/HOME/BAISONG/ADOOP-2.5.0-SRC directory, enter the following command:
$ mvn Package-pdist-dskiptests-dtar
After compiling successfully, the output information is as follows:
6. Generate the Eclipse project file with the following command:
$ cd Hadoop-maven-plugins
$ mvn Install
$ cd HADOOP-2.5.0-SRC
$ mvn eclipse:eclipse-dskiptests
After the successful output information such as:
7. Import the source code in Eclipse: "File" >> "import" >> "Existing Projects into Workspace", select Hadoop-2.5.0-src, then confirm.
As shown, there are 59 errors encountered after importing, but the total is divided into 3 categories. Here's how to fix it:
error 1:org.apache.hadoop.ipc.protobuf.x cannot be resolved
The workaround is as follows, followed by the following command.
$ cd Hadoop-2.5.0-src/hadoop-common-project/hadoop-common/src/test/proto //Note: Enter this directory
$ protoc--java_out=. /java *.proto
Finally, refresh all the projects in eclipse. At this point, only 6 errors are left.
error 2:avrorecord cannot is resolved to a type Testavroserialization.java
Here's how to fix it:
First, download Avro-tools-1.7.4.jar (click to download). stored in the HADOOP-2.5.0-SRC directory.
Then execute the following command:
$ cd Hadoop-2.5.0-src/hadoop-common-project/hadoop-common/src/test/avro
$ java-jar ~/hadoop-2.5.0-src/avro-tools-1.7.4.jar compile schema AVRORECORD.AVSC: /java
Finally, refresh the Eclipse project. There are only 3 errors left.
error 3:project ' hadoop-streaming ' is missing required source ... Build Path Problem
Here's how to fix it:
Right-hadoop-streaming project->properties-> left Java Build path->source-> selected error entry, right remove, as shown in.
At this point, the creation of the Hadoop project in Eclipse is complete.
Hadoop Yarn (ii)--Create Eclipse Engineering