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

Last change on this file since 141 was 141, checked in by jazz, 14 years ago

新增 HBase 安裝/啟動/停止 script

  • Property svn:executable set to *
File size: 5.2 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 CYGWIN_ROOT=C:\hadoop4win
26set LOCAL_REPOSITORY=%cd%
27set CYGWIN_SETUP=%LOCAL_REPOSITORY%\cygwin_mirror\cyg-setup.exe
28set OLDPATH=%PATH%
29set PATH=%PATH%;%cd%\bin
30set CYGWIN=nodosfilewarning
31
32set MY_PACKAGE=%LOCAL_REPOSITORY%\my_packages
33set HADOOP_SRC=%MY_PACKAGE%\hadoop\hadoop-*.gz
34set HADOOP_DES=%CYGWIN_ROOT%\usr\src
35set JDK_SRC=%MY_PACKAGE%\jdk\jdk*.zip
36set JDK_DES=%CYGWIN_ROOT%\usr\src
37
38REM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
39REM Assert that there exists a valid %LOCAL_REPOSITORY% directory.
40REM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
41
42IF NOT EXIST "%LOCAL_REPOSITORY%" (
43  echo "ERROR: %LOCAL_REPOSITORY% DON'T EXIST"
44  exit /B 1
45)
46
47IF NOT EXIST "%LOCAL_REPOSITORY%\cygwin_mirror" (
48  echo "ERROR: %LOCAL_REPOSITORY%\cygwin_mirror DON'T EXIST"
49  exit /B 1
50)
51
52IF NOT EXIST "%LOCAL_REPOSITORY%\cygwin_mirror\release" (
53  echo "ERROR: %LOCAL_REPOSITORY%\cygwin_mirror\release DON'T EXIST"
54  exit /B 1
55)
56
57IF NOT EXIST "%LOCAL_REPOSITORY%\cygwin_mirror\setup.ini" (
58  echo "ERROR: %LOCAL_REPOSITORY%\cygwin_mirror\setup.ini DON'T EXIST"
59  exit /B 1
60)
61
62IF NOT EXIST "%CYGWIN_SETUP%" (
63  echo "ERROR: %CYGWIN_SETUP% DON'T EXIST"
64  exit /B 1
65)
66
67REM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
68REM Create a fake installation skeleton for Cygwin setup
69REM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
70IF NOT EXIST "%CYGWIN_ROOT%" (
71  mkdir "%CYGWIN_ROOT%"
72)
73
74IF NOT EXIST "%CYGWIN_ROOT%\etc\setup" (
75  mkdir "%CYGWIN_ROOT%\etc\setup"
76) ELSE (
77  del /Q "%CYGWIN_ROOT%\etc\setup\last-*"
78)
79
80REM -- Note that last-* must *not* containing whitespace, e.g. " " etc.
81REM -- This is why there below is no space in front of ">".
82
83echo Install > "%CYGWIN_ROOT%\etc\setup\last-action"
84echo %LOCAL_REPOSITORY% > "%CYGWIN_ROOT%\etc\setup\last-cache"
85echo cygwin_mirror > "%CYGWIN_ROOT%\etc\setup\last-mirror"
86echo "" > "%CYGWIN_ROOT%\etc\setup\setup.rc"
87echo "" > "%CYGWIN_ROOT%\etc\setup\net-method"
88echo "" > "%CYGWIN_ROOT%\etc\setup\net-proxy-host"
89echo "" > "%CYGWIN_ROOT%\etc\setup\net-proxy-port"
90echo "" > "%CYGWIN_ROOT%\etc\setup\extrakeys"
91echo "" > "%CYGWIN_ROOT%\etc\setup\chooser_window_settings"
92echo "" > "%CYGWIN_ROOT%\etc\setup\installed.db"
93echo "" > "%CYGWIN_ROOT%\etc\setup\timestamp"
94
95REM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
96REM Finally, run Cygwin setup quietly
97REM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
98
99echo To run  %CYGWIN_SETUP% -q -d -L -l "%LOCAL_REPOSITORY%\cygwin_mirror" -R "%CYGWIN_ROOT%"
100
101REM real do cygwin installation
102
103"%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
104
105REM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
106REM Installation of Hadoop and JDK
107REM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
108
109IF NOT EXIST "%HADOOP_SRC%" (
110  wget "%HADOOP_MIRROR%/%HADOOP_FILE%" -O "%MY_PACKAGE%\hadoop\%HADOOP_FILE%"
111)
112
113IF NOT EXIST "%JDK_SRC%" (
114  wget "%JDK_MIRROR%/%JDK_FILE%" -O "%MY_PACKAGE%\jdk\%JDK_FILE%"
115)
116
117IF NOT EXIST "%JDK_DES%" (
118  mkdir "%JDK_DES%"
119)
120
121IF NOT EXIST "%CYGWIN_ROOT%\opt\hadoop" (
122  copy "%HADOOP_SRC%" "%HADOOP_DES%"
123)
124
125IF NOT EXIST "%CYGWIN_ROOT%\lib\jvm" (
126  copy "%JDK_SRC%" "%JDK_DES%"
127)
128
129copy /Y "%MY_PACKAGE%\hadoop\bin\*" "%CYGWIN_ROOT%\bin"
130copy /Y "%MY_PACKAGE%\hbase\bin\*" "%CYGWIN_ROOT%\bin"
131xcopy /Y /E /I "%MY_PACKAGE%\hadoop\conf-examples" "%HADOOP_DES%\conf-examples"
132
133cls
134echo "====================================================="
135echo " run `hadoop4win-init' to extract Hadoop and JDK to "
136echo " proper PATH. It will format HDFS Namenode, too."
137echo "=====================================================" 
138%CYGWIN_ROOT%\bin\bash --login -c "/bin/hadoop4win-init"
139cls
140echo "====================================================="
141echo " Use `start-hadoop' and `stop-hadoop' to run single"
142echo " machine hadoop configuration."
143echo " ."
144echo " Use `jps' to check java process for troubleshooting."
145echo "=====================================================" 
146set PATH=%OLDPATH%
147CALL "%CYGWIN_ROOT%\Cygwin.bat"
Note: See TracBrowser for help on using the repository browser.