source: hadoop4win-setup/hadoop4win-setup.bat @ 172

Last change on this file since 172 was 144, checked in by jazz, 15 years ago
  • Property svn:executable set to *
File size: 5.8 KB
Line 
1@echo off
2
3REM ####################################################################
4REM # Unattended hadoop for windows installation
5REM #
6REM # License     : GPL
7REM # Author      : Jazz Yao-Tsung Wang <jazz@nchc.org.tw>
8REM # Last update : $Date$
9REM # Version   : $Rev$
10REM #
11REM # Usage: hadoop4win-setup.bat
12REM #
13REM # References:
14REM # [1] Henrik Bengtsson, Unattended Cygwin Installation, June 2, 2004.
15REM #     http://www.maths.lth.se/help/windows/cygwin/
16REM # [2] DRBL-WinRoll
17REM #     http://drbl.nchc.org.tw/drbl-winroll
18REM #     This script is modified from winroll-setup.bat
19REM ####################################################################
20
21set HADOOP_FILE=hadoop-0.20.1.tar.gz
22set HADOOP_MIRROR=http://ftp.twaren.net/Unix/Web/apache/hadoop/core/hadoop-0.20.1
23set JDK_FILE=jdk1.6.0_18.zip
24set JDK_MIRROR=http://tsmc.classcloud.org
25set HBASE_FILE=hbase-0.20.3.tar.gz
26set HBASE_MIRROR=http://ftp.twaren.net/Unix/Web/apache/hadoop/hbase/hbase-0.20.3
27set CYGWIN_ROOT=C:\hadoop4win
28set LOCAL_REPOSITORY=%cd%
29set CYGWIN_SETUP=%LOCAL_REPOSITORY%\cygwin_mirror\cyg-setup.exe
30set OLDPATH=%PATH%
31set PATH=%PATH%;%cd%\bin
32set CYGWIN=nodosfilewarning
33
34set MY_PACKAGE=%LOCAL_REPOSITORY%\my_packages
35set HADOOP_SRC=%MY_PACKAGE%\hadoop\%HADOOP_FILE%
36set HADOOP_DES=%CYGWIN_ROOT%\usr\src
37set JDK_SRC=%MY_PACKAGE%\jdk\%JDK_FILE%
38set JDK_DES=%CYGWIN_ROOT%\usr\src
39set HBASE_SRC=%MY_PACKAGE%\hbase\%HBASE_FILE%
40set HBASE_DES=%CYGWIN_ROOT%\usr\src
41
42REM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
43REM Assert that there exists a valid %LOCAL_REPOSITORY% directory.
44REM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
45
46IF NOT EXIST "%LOCAL_REPOSITORY%" (
47  echo "ERROR: %LOCAL_REPOSITORY% DON'T EXIST"
48  exit /B 1
49)
50
51IF NOT EXIST "%LOCAL_REPOSITORY%\cygwin_mirror" (
52  echo "ERROR: %LOCAL_REPOSITORY%\cygwin_mirror DON'T EXIST"
53  exit /B 1
54)
55
56IF NOT EXIST "%LOCAL_REPOSITORY%\cygwin_mirror\release" (
57  echo "ERROR: %LOCAL_REPOSITORY%\cygwin_mirror\release DON'T EXIST"
58  exit /B 1
59)
60
61IF NOT EXIST "%LOCAL_REPOSITORY%\cygwin_mirror\setup.ini" (
62  echo "ERROR: %LOCAL_REPOSITORY%\cygwin_mirror\setup.ini DON'T EXIST"
63  exit /B 1
64)
65
66IF NOT EXIST "%CYGWIN_SETUP%" (
67  echo "ERROR: %CYGWIN_SETUP% DON'T EXIST"
68  exit /B 1
69)
70
71REM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
72REM Create a fake installation skeleton for Cygwin setup
73REM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
74IF NOT EXIST "%CYGWIN_ROOT%" (
75  mkdir "%CYGWIN_ROOT%"
76)
77
78IF NOT EXIST "%CYGWIN_ROOT%\etc\setup" (
79  mkdir "%CYGWIN_ROOT%\etc\setup"
80) ELSE (
81  del /Q "%CYGWIN_ROOT%\etc\setup\last-*"
82)
83
84REM -- Note that last-* must *not* containing whitespace, e.g. " " etc.
85REM -- This is why there below is no space in front of ">".
86
87echo Install > "%CYGWIN_ROOT%\etc\setup\last-action"
88echo %LOCAL_REPOSITORY% > "%CYGWIN_ROOT%\etc\setup\last-cache"
89echo cygwin_mirror > "%CYGWIN_ROOT%\etc\setup\last-mirror"
90echo "" > "%CYGWIN_ROOT%\etc\setup\setup.rc"
91echo "" > "%CYGWIN_ROOT%\etc\setup\net-method"
92echo "" > "%CYGWIN_ROOT%\etc\setup\net-proxy-host"
93echo "" > "%CYGWIN_ROOT%\etc\setup\net-proxy-port"
94echo "" > "%CYGWIN_ROOT%\etc\setup\extrakeys"
95echo "" > "%CYGWIN_ROOT%\etc\setup\chooser_window_settings"
96echo "" > "%CYGWIN_ROOT%\etc\setup\installed.db"
97echo "" > "%CYGWIN_ROOT%\etc\setup\timestamp"
98
99REM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
100REM Finally, run Cygwin setup quietly
101REM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
102
103echo To run  %CYGWIN_SETUP% -q -d -L -l "%LOCAL_REPOSITORY%\cygwin_mirror" -R "%CYGWIN_ROOT%"
104
105REM real do cygwin installation
106
107IF NOT EXIST "%CYGWIN_ROOT%\bin\bash.exe" (
108  "%CYGWIN_SETUP%" -q -d -L -l "%LOCAL_REPOSITORY%\cygwin_mirror" -R "%CYGWIN_ROOT%" -P cygrunsrv,file,openssh,perl,procps,ncurses,rsync,sharutils,shutdown,subversion,tcp_wrappers,termcap,unzip,wget,zip,zlib
109)
110
111REM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
112REM Installation of Hadoop and JDK
113REM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
114
115IF NOT EXIST "%HADOOP_SRC%" (
116  wget "%HADOOP_MIRROR%/%HADOOP_FILE%" -O "%MY_PACKAGE%\hadoop\%HADOOP_FILE%"
117)
118
119IF NOT EXIST "%JDK_SRC%" (
120  wget "%JDK_MIRROR%/%JDK_FILE%" -O "%MY_PACKAGE%\jdk\%JDK_FILE%"
121)
122
123IF NOT EXIST "%HBASE_SRC%" (
124  wget "%HBASE_MIRROR%/%HBASE_FILE%" -O "%MY_PACKAGE%\hbase\%HBASE_FILE%"
125)
126
127IF NOT EXIST "%JDK_DES%" (
128  mkdir "%JDK_DES%"
129)
130
131IF NOT EXIST "%CYGWIN_ROOT%\opt\hadoop" (
132  copy "%HADOOP_SRC%" "%HADOOP_DES%"
133)
134
135IF NOT EXIST "%CYGWIN_ROOT%\lib\jvm" (
136  copy "%JDK_SRC%" "%JDK_DES%"
137)
138
139IF NOT EXIST "%CYGWIN_ROOT%\opt\hbase" (
140  copy "%HBASE_SRC%" "%HBASE_DES%"
141)
142
143copy /Y "%MY_PACKAGE%\hadoop\bin\*" "%CYGWIN_ROOT%\bin"
144copy /Y "%MY_PACKAGE%\hbase\bin\*" "%CYGWIN_ROOT%\bin"
145xcopy /Y /E /I "%MY_PACKAGE%\hadoop\conf-examples" "%HADOOP_DES%\conf-examples"
146
147cls
148echo "====================================================="
149echo " run `hadoop4win-init' to extract Hadoop and JDK to "
150echo " proper PATH. It will format HDFS Namenode, too."
151echo "=====================================================" 
152%CYGWIN_ROOT%\bin\bash --login -c "/bin/hadoop4win-init"
153cls
154echo "====================================================="
155echo " Use `start-hadoop' and `stop-hadoop' to run single  "
156echo " machine hadoop configuration.                       "
157echo " .                                                   "
158echo " Use `jps' to check java process for troubleshooting."
159echo " .                                                   "
160echo " Use `hbase-init' to install single machine HBase .  "
161echo "=====================================================" 
162set PATH=%OLDPATH%
163CALL "%CYGWIN_ROOT%\Cygwin.bat"
Note: See TracBrowser for help on using the repository browser.