빅데이터 컴퓨팅 기술을 배우려면 하둡은 필수!

뭔지 모르겠지만 일단 설치시작해보자!


windows에서 hadoop 설치는 고난의 연속이라고 들은 적이 있으나 스터디가 목적이므로 강행 하였다. 

일단 : http://hadoop.apache.org/ 에 접속하여 살펴보기.

사용법이 리눅스 기준이네... 


windows 에서 빌드하려면 http://wiki.apache.org/hadoop/Hadoop2OnWindows 를 참조하라고 한다. 

그럼 설치 시작!

1. 지원하는?(테스트 해본, 될것같은) windows버전 이다. 

Windows Server 2008
Windows Server 2008 R2 
Windows Vista
Windows 7

설치하면서 찾아보니 Windows8 에서도 설치하는 사람이 많은것으로 보아 windows8 에서도 잘 되는듯 하다. 

2. Java 설치 JAVA_HOME 세팅

- Oracle JDK 1.6, 1.7 에서 테스트 됨. 
- JAVA_HOME을 잡을때 경로에 space가 들어가지 않도록 주의!

3. Hadoop sources 다운로드

다운로드 : http://apache.tt.co.kr/hadoop/common/hadoop-2.5.0/
일단 무조껀 최신버전! 2.5.0 src를 받았다. 

잘 진행되고 있군... 압축을 풀어보니 maven 프로젝트네 ㅋㅋㅋ 별거아니지.. 하고 빌드 시작.. 


이제부터 난이도 상승...

http://wiki.apache.org/hadoop/Hadoop2OnWindows 페이지에 

2.4를 보면 BUILDING.txt 파일을 보고 빌드에 필요한 환경을 설정 하라는 식으로 글이 있다. 

쭉 보다보면 Building on Windows 이라고 써있는 것이 보인다. 

Requirements:

* Windows System
* JDK 1.6+
* Maven 3.0 or later
* Findbugs 1.3.9 (if running findbugs)
* ProtocolBuffer 2.5.0
* Windows SDK or Visual Studio 2010 Professional
* Unix command-line tools from GnuWin32 or Cygwin: sh, mkdir, rm, cp, tar, gzip
* zlib headers (if building native code bindings for zlib)
* Internet connection for first build (to fetch all Maven and Hadoop dependencies)

처음 보면서 든생각.

1. windows system -> 당연하지 windows 설치 요구사항이니까..ㅋㅋ 
2. JDK1.6+ -> 이미 설치 되어있네 패쓰 
3. Maven 3.0 or later -> 이미 설치 되어있네 패쓰
4. Findbugs 1.3.9(if running findbugs) -> 정적분석툴.. 안쓸거니까 skip 해도될듯?
5. ProtocolBuffer 2.5.0 -> 구글에서 만든 오픈소스 직렬화 라이브러리 라고 책에나오네.. 이걸 쓰는구나..
6. Windows SDK or Visual Studio 2010 Professional -> 뭐지 이거 모르겠다 비쥬얼 스튜디오 비싸지 않나?
7. Unix command-line tools from GnuWin32 or Cygwin : sh, mkdir, rm, cp, tar, gzip -> 이게 필요하구나.. 난 CygWin이 이미 설치되어 있지 후훗..
8. zlip headers (if building native code bindings for zlib) -> 이건 뭐지?
9 internet connection for first build -> maven 빌드할때 central repository에서 받아와야 되니까 필요하겠지

모르겠는건 빼고 일단 빌드 해보자 하다가 낭패를 당하게 되었다.
하나하나 빌드에 꼭 필요한 중요한 것들이었다. 간과 하면 안된다.
BUILDING.txt를 꼼꼼히 읽었다면 많은 시행착오를 피할수 있었을 것이다.


1. Hadoop 빌드 전에 필요한 것들 설치하기

1. JAVA 설치 : http://oracle.com

2. MAVEN 설치 : https://cygwin.com/install.html

3. Cygwin. 설치:http://maven.apache.org/download.cgi

4. Microsoft Windows SDK v7.1. 설치 : http://www.microsoft.com/en-in/download/details.aspx?id=8279

5. Protocol Buffers 2.5.0 다운받아 압축풀기 : http://protobuf.googlecode.com/files/protoc-2.5.0-win32.zip

- ex) D:\install\protoc-2.5.0-win32

6. zlib 압축 풀기 : http://www.zlib.net/

- ex) D:\install\zlib128-dll

어짜피 에러나면 설치해야 하니 미리 설치하는것이 좋다.


JAVA_HOME 설정, M2_HOME(안해도 됨), Platform 환경 변수 세팅.

set Platform=x64 (when building on a 64-bit system)

set Platform=Win32 (when building on a 32-bit system)

이 값은 (case-sensitive) 대소문자를 구별하므로 주의 합시다!

"Platform" O

"PLATFORM" X 

"platform" X

Environment Variables - JAVA_HOME, M2_HOME and Platform


CygWin, maven, ProtocolBuffer 디렉토리를 path 에 등록 exe가 있는 디렉토리를 등록해야 한다.


PATH Variable - Cygwin & Protocol Buffers


다운로드 받은  hadoop-2.4.1-src.tar.gz 의 압축을 풀고 위치를 정해 카피헤 놓는다.

ex) D:\install\hadoop-2.4.1-src


2. maven 빌드 하기. 


command안된다, Cywin 안된다. Windows SDK 7.1 Command Prompt 를 사용해야 한다. 

windows SDK7.1 을 설치 했다면 아래 경로에 실행파일이 있을 것이다.

Select Start --> All Programs --> Microsoft Windows SDK v7.1 and open Windows SDK 7.1 Command Prompt


D:\install\hadoop-2.4.1-src 경로로 이동 후 아래 명령어 입력

mvn package -Pdist,native-win -DskipTests -Dtar


빌드중.......


아마 에러가 날것 이다. 

에러 로그 조금 위를 보면 cannot open include file zlib.h windows 이런 내용?이 있다 컴파일 에러...

c 컴파일 하다가 에러나네.. 아.. 뭐지..

D:\install\zlib128-dll 디렉 토리를 보면 include 디렉토리에 있는 zlib.h,zconf.h 를 복사하여 

D:\install\zlib128-dll 디렉토리에 복사 하고 다시 실행 하니 잘된다.


다시빌드.. 이건또 뭔 에러여..

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-javadoc-plugin:2.8.1:jar (module-javadocs) on project hadoop-common: ArchiverException: Error while creating archive: Problem creating jar: D:\install\hadoop-2.4.1-src\hadoop-common-project\hadoop-common\target\hadoop-common-2.4.1\bin\hadoop.dll (액세스가 거부되었습니다) -> [Help 1]

이런 경험을 몇번 해본 사람이라면 아래의 행동을 취할것 이다. 

1. 당황하지 않고 관리자 권한으로 실행

2. 해당 디렉토리의 사용자 권한 세팅

D:\install\hadoop-2.4.1-src 우클릭 > 속성 > 보안 > 사용자별 권한 모두 


그런데 안된다...


우린 이미 Cywin을 path에 넣었다 

D:\install 디렉토리로 이동 chmod -R 777 hadoop-2.4.1-src 


다시 빌드 ... 우왕 성공! 


시행 착오들

Execute failed: java.io.IOException: Cannot run program "sh"

-> cygwin을 path에 등록 하자.


'protoc --version' did not return a version

-> ProtocolBuffer 를 다운받고 path에 등록 하자. 


Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2:exec (compile-ms-winutils) on project hadoop-common: Command execution failed. Cannot run program "msbuild" (in directory "D:\install\hadoop-2.4.1-src\hadoop-common-project\hadoop-common"): CreateProcess error=2 ~~~ 

-> maven 명령어를 command나 cygwin에서 실행 하면 안된다. 
Windows SDK 7.1 Command Prompt 를 사용해야 한다.

http://www.srccodes.com/p/article/38/build-install-configure-run-apache-hadoop-2.2.0-microsoft-windows-os -> 이형네 스크린샷을 퍼왔습니다. 

'Hadoop' 카테고리의 다른 글

flume 정리.  (0) 2014.10.08
windows 에서 hadoop 시작 하기.  (0) 2014.08.14
Posted by 마법수정화살
,