[129] | 1 | #!/bin/bash |
---|
| 2 | mkdir -p /lib/jvm |
---|
| 3 | mkdir -p /opt |
---|
[143] | 4 | |
---|
[129] | 5 | if [ ! -x /lib/jvm/jdk* ]; then |
---|
[241] | 6 | echo "Installing Sun JDK ...." |
---|
[129] | 7 | unzip /usr/src/jdk*.zip -d /lib/jvm/ |
---|
| 8 | fi |
---|
[143] | 9 | |
---|
[129] | 10 | if [ ! -x /opt/hadoop ]; then |
---|
[241] | 11 | echo "Installing Hadoop ...." |
---|
[129] | 12 | tar zxvf /usr/src/hadoop-*.tar.gz -C /opt/ |
---|
[241] | 13 | mv /opt/hadoop-* /opt/hadoop |
---|
| 14 | cp -R /usr/src/conf-examples/ /opt/hadoop/conf-pseudo |
---|
| 15 | mv /opt/hadoop/conf/ /opt/hadoop/conf-local |
---|
| 16 | ln -s /opt/hadoop/conf-pseudo /opt/hadoop/conf |
---|
[129] | 17 | fi |
---|
[143] | 18 | |
---|
[129] | 19 | export JAVA_HOME=$(dirname /lib/jvm/jdk*/bin/) |
---|
[136] | 20 | echo export JAVA_HOME=$JAVA_HOME >> /opt/hadoop/conf/hadoop-env.sh |
---|
| 21 | echo export HADOOP_HOME=/opt/hadoop >> /opt/hadoop/conf/hadoop-env.sh |
---|
[140] | 22 | echo export HADOOP_CLASSPATH=/opt/hadoop >> /opt/hadoop/conf/hadoop-env.sh |
---|
| 23 | echo export HADOOP_CONF_DIR=/opt/hadoop/conf >> /opt/hadoop/conf/hadoop-env.sh |
---|
| 24 | echo export JAVA_HOME=$JAVA_HOME >> /etc/profile |
---|
| 25 | echo "export PATH=/opt/hadoop/bin/:$JAVA_HOME/bin:\$PATH" >> /etc/profile |
---|
[129] | 26 | cd $JAVA_HOME |
---|
| 27 | chmod a+x `find . -name "*.exe"` |
---|
| 28 | chmod a+x `find . -name "*.dll"` |
---|
| 29 | cd /opt/hadoop |
---|
[236] | 30 | /opt/hadoop/bin/hadoop namenode -format |
---|
[232] | 31 | source /etc/profile |
---|
[140] | 32 | /bin/start-hadoop |
---|
[241] | 33 | sleep 10 |
---|
| 34 | /opt/hadoop/bin/hadoop dfsadmin -safemode leave |
---|
[236] | 35 | /opt/hadoop/bin/hadoop fs -mkdir tmp |
---|
[140] | 36 | echo "/bin/stop-hadoop" > ~/.bash_logout |
---|
| 37 | echo "/bin/stop-hadoop" > /etc/skel/.bash_logout |
---|
[129] | 38 | cygstart http://localhost:50070 |
---|
[139] | 39 | cygstart http://localhost:50030 |
---|
[236] | 40 | exit |
---|