source: hadoop4win-setup/my_packages/hadoop/bin/hadoop4win-init @ 242

Last change on this file since 242 was 242, checked in by jazz, 14 years ago
  • modified hadoop4win-setup.bat
    • remove copying hadoop/conf-examples
  • removed my_packages/hadoop/conf-examples
  • modified hadoop4win-init
    • [BUGFIX] when using conf-examples, Win7 will not able to set the correct permission. Now we use copy default conf folder to conf-pseudo.
  • Property svn:executable set to *
File size: 1.9 KB
Line 
1#!/bin/bash
2mkdir -p /lib/jvm
3mkdir -p /opt
4
5if [ ! -x /lib/jvm/jdk* ]; then
6  echo "Installing Sun JDK ...."
7  unzip /usr/src/jdk*.zip -d /lib/jvm/
8fi
9
10if [ ! -x /opt/hadoop ]; then
11  echo "Installing Hadoop ...."
12  tar zxvf /usr/src/hadoop-*.tar.gz -C /opt/
13  mv /opt/hadoop-* /opt/hadoop
14  cp /opt/hadoop/conf/ /opt/hadoop/conf-local
15  mv /opt/hadoop/conf/ /opt/hadoop/conf-pseudo
16  ln -s /opt/hadoop/conf-pseudo /opt/hadoop/conf
17  cat > /opt/hadoop/conf/core-site.xml << EOF
18<?xml version="1.0"?>
19<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
20<configuration>
21  <property>
22    <name>fs.default.name</name>
23    <value>hdfs://localhost:9000</value>
24  </property>
25  <property>
26    <name>hadoop.tmp.dir</name>
27    <value>/var/hadoop/hadoop-\${user.name}</value>
28  </property>
29</configuration>
30EOF
31  cat > /opt/hadoop/conf/hdfs-site.xml << EOF
32<?xml version="1.0"?>
33<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
34<configuration>
35  <property>
36    <name>dfs.replication</name>
37    <value>1</value>
38  </property>
39</configuration>
40EOF
41fi
42
43export JAVA_HOME=$(dirname /lib/jvm/jdk*/bin/)
44echo export JAVA_HOME=$JAVA_HOME >> /opt/hadoop/conf/hadoop-env.sh
45echo export HADOOP_HOME=/opt/hadoop >> /opt/hadoop/conf/hadoop-env.sh
46echo export HADOOP_CLASSPATH=/opt/hadoop >> /opt/hadoop/conf/hadoop-env.sh
47echo export HADOOP_CONF_DIR=/opt/hadoop/conf >> /opt/hadoop/conf/hadoop-env.sh
48echo export JAVA_HOME=$JAVA_HOME >> /etc/profile
49echo "export PATH=/opt/hadoop/bin/:$JAVA_HOME/bin:\$PATH" >> /etc/profile
50cd $JAVA_HOME
51chmod a+x `find . -name "*.exe"`
52chmod a+x `find . -name "*.dll"`
53cd /opt/hadoop
54/opt/hadoop/bin/hadoop namenode -format
55source /etc/profile
56/bin/start-hadoop
57sleep 10
58/opt/hadoop/bin/hadoop dfsadmin -safemode leave
59/opt/hadoop/bin/hadoop fs -mkdir tmp
60echo "/bin/stop-hadoop" > ~/.bash_logout
61echo "/bin/stop-hadoop" > /etc/skel/.bash_logout
62cygstart http://localhost:50070
63cygstart http://localhost:50030
64exit
Note: See TracBrowser for help on using the repository browser.