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