我們需要准備一下文件:
1.eclipse下載地址是:http://www.eclipse.org/downloads/
2.Hadoop的Eclipse插件(版本為2.7.2對應hadoop版本2.7):http://download.csdn.net/detail/u012999810/9524816
首先需要在ubuntu下安裝hadoop,這裡不做詳細介紹,站在其他人的肩膀上來的更快,所以請參考:http://www.powerxing.com/install-hadoop/
hadoop安裝好之後我們就可以開始hadoop+eclipse開發環境的搭建了:
1.安裝eclipse:
打開eclipse下載地址之後,默認是windows版本,所以我們重新選擇linux版本,之後等待頁面跳轉:

頁面轉到linux版本頁面之後,我們選擇如下工具下載,位數需要根據系統位數選擇:

查看linux系統位數的命令是:getconf LONG_BIT
下面的例子輸出的結果是64,說明系統的位數是64位,所以選擇64位版本下載:

下載,等待下載完成:

下載完成後將文件復制到虛擬機(如果是在虛擬機裡面下載的,跳過此步驟),解壓到自己希望安裝的目錄即可。(這裡有一個問題,如果你不是直接在虛擬機裡面下載的,那麼需要將文件復制到虛擬機。一般直接將文件拖拽進入虛擬機的相應文件夾就可以了,但是有時候會出現不能拖拽,或者不能復制粘貼的情況。這時候,我們將虛擬機的Vmware Tools重新安裝,一般就可以解決問題。)
之後啟動eclipse,將開始的頁面關閉,直接進入eclipse,看是否可以正常打開。(在解壓後的文件夾下面,雙擊如下圖標:)

將下載的hadoop-eclipse-plugin-2.2.0.jar文件放到Eclipse的dropins目錄下,重啟Eclipse,選擇window>perspective>open perspective>other,可以看到map/reduce已經生效。

生效之後,我們選擇這裡的map/reduce,在點擊ok,進入map/Reduce的配置頁面,在頁面下面位置單擊右鍵,選擇EditHadoop location… ,進入編輯頁面。

編輯頁面:

location name可以自己定義:
第一個host寫localhost,port為我們安裝hadoop時配置偽分布式安裝的時候的port,下圖:

第二個host默認是localhost,port可以在hadoop/etc/hadoop中的core-site.xml文件中查看。

成功之後,我們可以看到下面的文件結構:
到這裡就配置完成了。 下面開始我們第一個Mapreduce項目的創建:
選擇file>new>other>MepReduce project

上面劃線的地方選擇你安裝的hadoop的路徑。
配置過程就完全結束了,剩下的自己看各種教程去學吧!!!!