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
@q463746583
Copy link

q463746583 commented Jul 8, 2019

==> Downloading https://www.apache.org/dyn/closer.cgi?path=hadoop/common/hadoop-2.7.3/hadoop-2.7.3.tar.gz
Already downloaded: /Users/cvanzy/Library/Caches/Homebrew/downloads/fa29189d25e42f18e1b3c630e2e3081032991052ad49225c131534cad91d1cf7--hadoop-2.7.3.tar.gz
Warning: This keg was marked linked already, continuing anyway
Error: undefined method `undent' for #<String:0x0000000102342c10>
Please report this bug:
  https://docs.brew.sh/Troubleshooting
/Users/cvanzy/Library/Caches/Homebrew/Formula/hadoop.rb:38:in `caveats'
/usr/local/Homebrew/Library/Homebrew/caveats.rb:19:in `caveats'
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/forwardable.rb:202:in `empty?'
/usr/local/Homebrew/Library/Homebrew/formula_installer.rb:618:in `caveats'
/usr/local/Homebrew/Library/Homebrew/formula_installer.rb:667:in `finish'
/usr/local/Homebrew/Library/Homebrew/cmd/install.rb:333:in `install_formula'
/usr/local/Homebrew/Library/Homebrew/cmd/install.rb:264:in `block in install'
/usr/local/Homebrew/Library/Homebrew/cmd/install.rb:262:in `each'
/usr/local/Homebrew/Library/Homebrew/cmd/install.rb:262:in `install'
/usr/local/Homebrew/Library/Homebrew/brew.rb:102:in `<main>'

@q463746583
Copy link

It raises an error

@hansohn
Copy link
Author

hansohn commented Jul 9, 2019

By any chance have you already installed hadoop via brew previously?
If you run brew list do you see hadoop?
If you run hadoop version do you get a response?

@q463746583
Copy link

I think I have installed version 3.1.2 before.
but when I decide to downgrade to 2.7, I use brew uninstall hadoop to remove the package.

For now, I configure that hadoop from scratch manually.

@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