-
Notifications
You must be signed in to change notification settings - Fork 2
/
env.src
51 lines (43 loc) · 1.71 KB
/
env.src
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# Name: env.src
# Purpose: Set Big Data environment for OS X and Linux
# Author: Nick Rozanski
# Syntax: source env.src
# Notes: the Windows version is env.cmd
# you must 'source' this file, not run it
export uname="$(uname | tr '[:upper:]' '[:lower:]')"
# [ -n "$(echo $uname | grep cygwin)" ] && uname=cygwin
echo Operating system is $uname.
if [ -z "$JAVA_HOME" ]; then
if [ -f /usr/libexec/java_home ]; then
# Mac OS X has this
export JAVA_HOME="$(/usr/libexec/java_home)"
else
if [ "$uname" == linux ]; then
export JAVA_HOME="$(dirname $(dirname $(readlink -f /etc/alternatives/java)))"
elif [ "$uname" == darwin ]; then
export JAVA_HOME=/Library/Java/JavaVirtualMachines/Current.jdk/Contents/Home
# elif [ "$uname" == cygwin ]; then
# Windows / Cygwin - does not work
# [ -z "$JAVA_HOME" ] && echo ERROR: Please set JAVA_HOME in Control Panel
else
echo Warning: unsupported operating system $uname.
fi
fi
fi
echo JAVA_HOME is $JAVA_HOME.
[ ! -f $JAVA_HOME/bin/java ] && echo "WARNING: JAVA_HOME seems to be incorrect ($JAVA_HOME)"
export SPA_2016=$HOME/SPA_2016
echo SPA_2016 is $SPA_2016
# Hadoop configuration
export HADOOP_PREFIX=$SPA_2016/hadoop
export HADOOP_CONF_DIR="$HADOOP_PREFIX/etc/hadoop"
export HADOOP_HOME="$HADOOP_PREFIX"
export HADOOP_COMMON_HOME="$HADOOP_PREFIX"
export HADOOP_HDFS_HOME="$HADOOP_PREFIX"
export HADOOP_YARN_HOME="$HADOOP_PREFIX"
# export HADOOP_COMMON_LIB_NATIVE_DIR=$HADOOP_HOME/lib/native
export HADOOP_OPTS="-Djava.library.path=$HADOOP_HOME/lib"
# Spark configuration
export SPARK_HOME=$SPA_2016/spark
# Hive configuration
export HIVE_HOME=$SPA_2016/hive