sahara-image-elements/elements/hadoop-cdh/post-install.d/40-setup-hadoop
Pino Toscano e1c6b32d1e hadoop-cdh: simplify package installation
Move the repository addition in a pre-install.d script, as that is the
right place for such operations (no more need to manual `apt-get update`
run), and switch it from curl to wget (already in use in that script);
as a result, wget is now installed in pre-install.d.

The above change makes the installation of hadoop-hdfs-namenode and
hadoop-hdfs-datanode possible using the declarative package-installs
way.

As a side effect of installing packages before setting up the hadoop
user and group, make sure to not create them if already present. The
packaging as of today takes care of creating the hadoop group, so guard
the setup in case it is not done anymore or will be done for the user
too.

Change-Id: I248872e77358f8388f4a66a54e53b2ffa727c7e3
2015-05-18 15:42:57 +02:00

35 lines
828 B
Bash
Executable File

#!/bin/bash
# This element installs Hadoop CDH 4 HDFS from Cloudera.
# It does not do a full install of CDH, it installs the miminum needed to
# Spark to run correctly.
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
set -x
fi
set -eu
set -o pipefail
echo "Creating hadoop user & group"
case "$DISTRO_NAME" in
ubuntu )
if ! getent group hadoop > /dev/null; then
addgroup hadoop
fi
if ! getent passwd hadoop > /dev/null; then
adduser --ingroup hadoop --disabled-password --gecos GECOS hadoop
fi
adduser hadoop sudo
;;
esac
echo "Pre-configuring Hadoop"
cat >> /home/hadoop/.bashrc <<EOF
PATH=$PATH:/usr/sbin
EOF
cat >> /etc/hadoop/hadoop-env.sh <<EOF
export HADOOP_LOG_DIR=/mnt/log/hadoop/\$USER
export HADOOP_SECURE_DN_LOG_DIR=/mnt/log/hadoop/hdfs
EOF