Skip to content

Instantly share code, notes, and snippets.

@hansohn
Last active April 3, 2020 21:52
Show Gist options
  • Save hansohn/7eb167146621a7a1816c180a57f53a9a to your computer and use it in GitHub Desktop.
Save hansohn/7eb167146621a7a1816c180a57f53a9a to your computer and use it in GitHub Desktop.
Install Hadoop 2.7.3 via brew
#!/usr/bin/env bash
BREW_PREFIX=$(brew --prefix);
# abort if already installed, else continue
if ! grep -q hadoop <(brew list); then
# unlink broken installation attempts
brew unlink hadoop > /dev/null 2>&1;
# install hadoop 2.7.3
# expect benign errors
brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/7a4dabfc1a2acd9f01a1670fde4f0094c4fb6ffa/Formula/hadoop.rb;
# retain backup of default configs
cp -R ${BREW_PREFIX}/Cellar/hadoop/2.7.3/libexec/etc/hadoop ${BREW_PREFIX}/Cellar/hadoop/2.7.3/libexec/etc/hadoop_default;
# export hadoop envs
if [ -d "${BREW_PREFIX}/Cellar/hadoop" ]; then
export HADOOP_VERSION="$(brew list --versions hadoop | awk '{ print $2 }')";
export HADOOP_HOME="${BREW_PREFIX}/Cellar/hadoop/${HADOOP_VERSION}";
export HADOOP_CONF_DIR="${HADOOP_HOME}/libexec/etc/hadoop";
fi
else
echo "Aborting... Hadoop installation already exists";
fi
@jonashartwig
Copy link

I got the same error unfortunately.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment