#!/bin/bash mkdir -p /lib/jvm mkdir -p /opt if [ ! -x /lib/jvm/jdk* ]; then echo "Installing Sun JDK ...." unzip /usr/src/jdk*.zip -d /lib/jvm/ fi if [ ! -x /opt/hadoop ]; then echo "Installing Hadoop ...." tar zxvf /usr/src/hadoop-*.tar.gz -C /opt/ mv /opt/hadoop-* /opt/hadoop cp -R /usr/src/conf-examples/ /opt/hadoop/conf-pseudo mv /opt/hadoop/conf/ /opt/hadoop/conf-local ln -s /opt/hadoop/conf-pseudo /opt/hadoop/conf fi export JAVA_HOME=$(dirname /lib/jvm/jdk*/bin/) echo export JAVA_HOME=$JAVA_HOME >> /opt/hadoop/conf/hadoop-env.sh echo export HADOOP_HOME=/opt/hadoop >> /opt/hadoop/conf/hadoop-env.sh echo export HADOOP_CLASSPATH=/opt/hadoop >> /opt/hadoop/conf/hadoop-env.sh echo export HADOOP_CONF_DIR=/opt/hadoop/conf >> /opt/hadoop/conf/hadoop-env.sh echo export JAVA_HOME=$JAVA_HOME >> /etc/profile echo "export PATH=/opt/hadoop/bin/:$JAVA_HOME/bin:\$PATH" >> /etc/profile cd $JAVA_HOME chmod a+x `find . -name "*.exe"` chmod a+x `find . -name "*.dll"` cd /opt/hadoop /opt/hadoop/bin/hadoop namenode -format source /etc/profile /bin/start-hadoop sleep 10 /opt/hadoop/bin/hadoop dfsadmin -safemode leave /opt/hadoop/bin/hadoop fs -mkdir tmp echo "/bin/stop-hadoop" > ~/.bash_logout echo "/bin/stop-hadoop" > /etc/skel/.bash_logout cygstart http://localhost:50070 cygstart http://localhost:50030 exit