Created
June 28, 2014 02:21
-
-
Save ianatha/fa4424860aa814137c85 to your computer and use it in GitHub Desktop.
Install Hadoop 1.0.3 using Homebrew
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
HADOOP_VERSION=1.0.3 | |
HADOOP_URL=http://archive.apache.org/dist/hadoop/core/hadoop-$HADOOP_VERSION/hadoop-$HADOOP_VERSION.tar.gz | |
pushd `brew --prefix` | |
CHECKOUT_CMD=`brew versions hadoop 2> /dev/null | grep $HADOOP_VERSION | awk -F " " '{ print $2 }'` | |
echo $CHECKOUT_CMD... | |
$CHECKOUT_CMD | |
sed -i -e "s# url '.*'# url '$HADOOP_URL'#" Library/Formula/hadoop.rb | |
echo brew install hadoop... | |
brew install hadoop | |
pushd Cellar/hadoop/$HADOOP_VERSION/libexec | |
echo Installing configuration files... | |
echo "export HADOOP_OPTS=\"-Djava.security.krb5.realm=OX.AC.UK -Djava.security.krb5.kdc=kdc0.ox.ac.uk:kdc1.ox.ac.uk\"" >> conf/hadoop-env.sh | |
echo """<?xml version=\"1.0\"?> | |
<?xml-stylesheet type=\"text/xsl\" href=\"configuration.xsl\"?> | |
<configuration> | |
<property> | |
<name>hadoop.tmp.dir</name> | |
<value>${HOME}/.hadoop</value> | |
</property> | |
<property> | |
<name>fs.default.name</name> | |
<value>hdfs://localhost:8020</value> | |
</property> | |
</configuration>""" > conf/core-site.xml | |
echo """<?xml version=\"1.0\"?> | |
<?xml-stylesheet type=\"text/xsl\" href=\"configuration.xsl\"?> | |
<configuration> | |
<property> | |
<name>mapred.job.tracker</name> | |
<value>localhost:9001</value> | |
</property> | |
<property> | |
<name>mapred.tasktracker.map.tasks.maximum</name> | |
<value>2</value> | |
</property> | |
<property> | |
<name>mapred.tasktracker.reduce.tasks.maximum</name> | |
<value>2</value> | |
</property> | |
</configuration> | |
""" > conf/mapred-site.xml | |
echo """<?xml version=\"1.0\"?> | |
<?xml-stylesheet type=\"text/xsl\" href=\"configuration.xsl\"?> | |
<configuration> | |
<property> | |
<name>dfs.replication</name> | |
<value>1</value> | |
</property> | |
</configuration>""" > conf/hdfs-site.xml | |
echo Replacing commons-codec... | |
rm lib/commons-codec-1.4.jar | |
curl http://central.maven.org/maven2/commons-codec/commons-codec/1.6/commons-codec-1.6.jar > lib/commons-codec-1.6.jar | |
popd | |
popd | |
brew pin hadoop | |
mkdir -p ${HOME}/.hadoop/ | |
hadoop namenode -format | |
echo | |
echo | |
echo "use start-all.sh and stop-all.sh to manage Hadoop" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment