forked from sunlabuiuc/bigbox-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall-zeppelin.sh
executable file
·76 lines (59 loc) · 2.53 KB
/
install-zeppelin.sh
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/usr/bin/env bash
set -e
set -o pipefail
# iptables does not exists in this container
# echo "Disable ipatbles"
# sudo service iptables stop
# sudo chkconfig iptables off
pushd /usr/local/
if [ ! -d zeppelin ]; then
#
read -p "Make sure you have already started hadoop services. (yes to continue, no to abort and try again after your services started) [y/N]" -n 1 -r
echo ""
if [[ $REPLY =~ ^[Yy]$ ]]; then
echo "Starting..."
else
echo "Aborted.."
exit 1
fi
echo "Downloading Zeppelin..."
wget http://sunlab.org/teaching/download/zeppelin-0.7.3-bin-netinst.tgz
tar -xzf zeppelin-0.7.3-bin-netinst.tgz
rm -rf zeppelin-0.7.3-bin-netinst.tgz
mv zeppelin-0.7.3-bin-netinst zeppelin
pushd zeppelin
echo 'List Interpreters...'
./bin/install-interpreter.sh -l
REQUIRED_INTERPRETERS=file,hbase,md,shell,python,pig
echo "Install Interpreters: $REQUIRED_INTERPRETERS"
./bin/install-interpreter.sh -n $REQUIRED_INTERPRETERS
echo 'Update Configures...'
cat conf/zeppelin-site.xml.template > conf/zeppelin-site.xml
sed -i 's/8080/9530/' conf/zeppelin-site.xml
echo '#!/bin/bash' > conf/zeppelin-env.sh
# initialize the environment
echo '[ -f /etc/profile.d/bigbox.sh ] && . /etc/profile.d/bigbox.sh' >> conf/zeppelin-env.sh
# unmatched spark
echo 'unset SPARK_HOME' >> conf/zeppelin-env.sh # use embedded spark binaries
cat conf/zeppelin-env.sh.template >> conf/zeppelin-env.sh
# when user want to run interpreter as end web user
echo 'export ZEPPELIN_IMPERSONATE_CMD='"'"'sudo -H -u ${ZEPPELIN_IMPERSONATE_USER} bash -c '"'"'' >> conf/zeppelin-env.sh
# logs is exists..
# mkdir logs
[ -d logs ] && chmod 777 logs
popd # /usr/local/
(! id -u zeppelin > /dev/null 2>&1 ) && adduser zeppelin
chown -R zeppelin:zeppelin zeppelin
sudo -u hdfs hdfs dfs -mkdir -p /user/zeppelin
sudo -u hdfs hdfs dfs -chown -R zeppelin:zeppelin /user/zeppelin
echo 'Zeppelin is Ready Now!'
echo 'Please use this command to start your service: '
echo 'sudo -u zeppelin /usr/local/zeppelin/bin/zeppelin-daemon.sh start'
echo 'Please use this command to stop your service: '
echo 'sudo -u zeppelin /usr/local/zeppelin/bin/zeppelin-daemon.sh stop'
else
echo "DIR: /usr/local/zeppelin detected, stop the installing progress"
echo "This used to prevent this script executed twice"
echo "If this folder is installed by yourself, please erase it first"
fi
popd # /