1. 程式人生 > >Mac brew install hadoop 出現 not linked

Mac brew install hadoop 出現 not linked

問題初始是 install 時 linked 不成功,導致後邊hadoop不能用

~ ᐅ brew install hadoop
Updating Homebrew...
Warning: hadoop 2.8.1 is already installed, it's just not linked.
You can use `brew link hadoop` to link this version.

接著按提示執行出現:

~ ᐅ brew link hadoop
Linking /usr/local/Cellar/hadoop/2.8.1...
Error: Could not symlink bin/yarn
Target /usr/local
/bin/yarn already exists. You may want to remove it: rm '/usr/local/bin/yarn' To force the link and overwrite all conflicting files: brew link --overwrite hadoop To list all files that would be deleted: brew link --overwrite --dry-run hadoop

再接著執行,提示 /usr/local/sbin is not writable

~ ᐅ brew link --overwrite hadoop
Linking /usr/local/Cellar/hadoop/2.8
.1... Error: Could not symlink sbin/distribute-exclude.sh /usr/local/sbin is not writable.
 ᐅ sudo chown -R `whoami`:admin /usr/local/sbin
 chown: /usr/local/sbin: No such file or directory

發現根本沒有sbin這個資料夾,接著根據 stackoverflow 執行:

mkdir /usr/local/sbin
mkdir: /usr/local/sbin: Permission denied

這個簡單,加 sudo 就好了

ᐅ sudo mkdir /usr/local/sbin

然後再次執行

ᐅ sudo chown -R `whoami`:admin /usr/local/sbin

ok,沒報錯,接著

ᐅ brew link hadoop
Linking /usr/local/Cellar/hadoop/2.8.1... 27 symlinks created

perfect !成功