summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Farrellee <matt@redhat.com>2013-07-11 17:46:26 -0400
committerMatthew Farrellee <matt@redhat.com>2013-07-12 07:54:27 -0400
commitc21cba3d7b33d2d268685ae855986f1187670496 (patch)
treef7d60f236d61cf0189227cebfa821fd3bfe11c38
parent60c36eb0b1d33f6fdde84ad749dc79dee19c0c74 (diff)
Merge first-boot, setup-hadoop and setup-ssh with distro switching based on lsb_release
Notes
Notes (review): Verified+2: Jenkins Approved+1: Sergey Lukjanov <slukjanov@mirantis.com> Code-Review+2: Sergey Lukjanov <slukjanov@mirantis.com> Code-Review+1: Alexander Ignatov <aignatov@mirantis.com> Code-Review+1: Ivan Berezovskiy <iberezovskiy@mirantis.com> Submitted-by: Jenkins Submitted-at: Tue, 16 Jul 2013 11:23:15 +0000 Reviewed-on: https://review.openstack.org/36741 Project: stackforge/savanna-extra Branch: refs/heads/master
-rwxr-xr-xelements/hadoop_fedora/first-boot.d/99-setup38
-rwxr-xr-xelements/hadoop_fedora/install.d/30-setup-hadoop67
-rwxr-xr-xelements/hadoop_fedora/install.d/40-setup-ssh1
3 files changed, 74 insertions, 32 deletions
diff --git a/elements/hadoop_fedora/first-boot.d/99-setup b/elements/hadoop_fedora/first-boot.d/99-setup
index bd4e732..27a7ed2 100755
--- a/elements/hadoop_fedora/first-boot.d/99-setup
+++ b/elements/hadoop_fedora/first-boot.d/99-setup
@@ -5,18 +5,26 @@ chown root:root /mnt
5mkdir -p /var/run/hadoop ; chown hadoop:hadoop /var/run/hadoop 5mkdir -p /var/run/hadoop ; chown hadoop:hadoop /var/run/hadoop
6mkdir -p /mnt/log/hadoop ; chown hadoop:hadoop /mnt/log/hadoop 6mkdir -p /mnt/log/hadoop ; chown hadoop:hadoop /mnt/log/hadoop
7 7
8# Unique to Ubuntu 8distro=$(lsb_release -is || :)
9#mkdir /run/hadoop 9case "$distro" in
10#chown hadoop:hadoop /run/hadoop/ 10 Ubuntu )
11#mkdir -p /home/ubuntu/.ssh 11 mkdir /run/hadoop
12#touch /home/ubuntu/.ssh/authorized_keys 12 chown hadoop:hadoop /run/hadoop/
13#chown -R ubuntu:ubuntu /home/ubuntu 13 mkdir -p /home/ubuntu/.ssh
14 14 touch /home/ubuntu/.ssh/authorized_keys
15# Unique to Fedora 15 chown -R ubuntu:ubuntu /home/ubuntu
16sleep 10 16 ;;
17rm /etc/resolv.conf 17 Fedora )
18service network restart 18 sleep 10
19chown -R ec2-user:ec2-user /home/ec2-user 19 rm /etc/resolv.conf
20chown -R ec2-user:ec2-user /etc/hadoop 20 service network restart
21#TODO: configure iptables (https://bugs.launchpad.net/savanna/+bug/1195744) 21 chown -R ec2-user:ec2-user /home/ec2-user
22iptables -F 22 chown -R ec2-user:ec2-user /etc/hadoop
23 #TODO: configure iptables (https://bugs.launchpad.net/savanna/+bug/1195744)
24 iptables -F
25 ;;
26 * )
27 echo "Unknown distro: $distro. Exiting."
28 exit 1
29 ;;
30esac
diff --git a/elements/hadoop_fedora/install.d/30-setup-hadoop b/elements/hadoop_fedora/install.d/30-setup-hadoop
index b0f80d1..81654f3 100755
--- a/elements/hadoop_fedora/install.d/30-setup-hadoop
+++ b/elements/hadoop_fedora/install.d/30-setup-hadoop
@@ -1,32 +1,65 @@
1#!/bin/bash 1#!/bin/bash
2echo "Hadoop setup begins" 2
3distro=$(lsb_release -is || :)
4if [ ! "$distro" == "Fedora" -a ! "$distro" == "Ubuntu" ]; then
5 echo "Unknown distro: $distro. Exiting."
6 exit 1
7fi
8
9echo "Hadoop setup begins for $distro"
3tmp_dir=/tmp/hadoop 10tmp_dir=/tmp/hadoop
4 11
5install-packages wget
6echo "Creating hadoop user & group" 12echo "Creating hadoop user & group"
7adduser -G adm,wheel hadoop 13case "$distro" in
14 Ubuntu )
15 addgroup hadoop
16 adduser --ingroup hadoop --disabled-password --gecos GECOS hadoop
17 adduser hadoop sudo
18 ;;
19 Fedora )
20 adduser -G adm,wheel hadoop
21 ;;
22esac
8 23
9echo "Hadoop version $DIB_HADOOP_VERSION will be injected into image. Starting the download" 24echo "Hadoop version $DIB_HADOOP_VERSION will be injected into image. Starting the download"
10wget -P $tmp_dir/ "http://archive.apache.org/dist/hadoop/core/hadoop-"$DIB_HADOOP_VERSION"/hadoop-"$DIB_HADOOP_VERSION"-1.x86_64.rpm" 25case "$distro" in
26 Ubuntu )
27 package="hadoop_$DIB_HADOOP_VERSION-1_x86_64.deb"
28 ;;
29 Fedora )
30 package="hadoop-$DIB_HADOOP_VERSION-1.x86_64.rpm"
31 ;;
32esac
33
34install-packages wget
35wget -P $tmp_dir "http://archive.apache.org/dist/hadoop/core/hadoop-$DIB_HADOOP_VERSION/$package"
11if [ $? -ne 0 ]; then 36if [ $? -ne 0 ]; then
12 echo -e "Could not find Hadoop version $DIB_HADOOP_VERSION.\nAborting" 37 echo -e "Could not find Hadoop version $DIB_HADOOP_VERSION.\nAborting"
13 exit 1 38 exit 1
14fi 39fi
15 40
16rpm -ivh --replacefiles $tmp_dir/hadoop-"$DIB_HADOOP_VERSION"-1.x86_64.rpm 41case "$distro" in
17chmod 755 /usr/sbin/start-* 42 Ubuntu )
18chmod 755 /usr/sbin/stop-* 43 dpkg -i $tmp_dir/$package
19chmod 755 /usr/sbin/slaves.sh 44 ;;
20chmod 755 /usr/sbin/update-hadoop-env.sh 45 Fedora )
21rm $tmp_dir/hadoop-"$DIB_HADOOP_VERSION"-1.x86_64.rpm 46 rpm -ivh --replacefiles $tmp_dir/$package
47 chmod 755 /usr/sbin/start-*
48 chmod 755 /usr/sbin/stop-*
49 chmod 755 /usr/sbin/slaves.sh
50 chmod 755 /usr/sbin/update-hadoop-env.sh
51 ;;
52esac
22rm -r $tmp_dir 53rm -r $tmp_dir
23 54
24echo "Pre-configuring Hadoop" 55echo "Pre-configuring Hadoop"
25filename=$(find $TARGET_ROOT/usr/java/ -maxdepth 1 -name "jdk*") 56filename=$(find $TARGET_ROOT/usr/java/ -maxdepth 1 -name "jdk*")
26echo -e "PATH=\$PATH:/usr/sbin:$filename/bin\nJAVA_HOME=$filename" >> /home/hadoop/.bashrc 57cat >> /home/hadoop/.bashrc <<EOF
27echo -e "HADOOP_HOME=/usr/share/hadoop/" >> /home/hadoop/.bashrc 58PATH=\$PATH:/usr/sbin:$filename/bin
28sed -i "s,export JAVA_HOME=.*,export JAVA_HOME=$filename," /etc/hadoop/hadoop-env.sh 59JAVA_HOME=$filename
29log_dir=/mnt/log/hadoop/\$USER/ 60HADOOP_HOME=/usr/share/hadoop/
30sed -i "s,export HADOOP_LOG_DIR=.*,export HADOOP_LOG_DIR=$log_dir," /etc/hadoop/hadoop-env.sh 61EOF
31log_dir=/mnt/log/hadoop/hdfs 62sed -i -e "s,export JAVA_HOME=.*,export JAVA_HOME=$filename," \
32sed -i "s,export HADOOP_SECURE_DN_LOG_DIR=.*,export HADOOP_SECURE_DN_LOG_DIR=$log_dir," /etc/hadoop/hadoop-env.sh 63 -e "s,export HADOOP_LOG_DIR=.*,export HADOOP_LOG_DIR=/mnt/log/hadoop/\$USER," \
64 -e "s,export HADOOP_SECURE_DN_LOG_DIR=.*,export HADOOP_SECURE_DN_LOG_DIR=/mnt/log/hadoop/hdfs," \
65 /etc/hadoop/hadoop-env.sh
diff --git a/elements/hadoop_fedora/install.d/40-setup-ssh b/elements/hadoop_fedora/install.d/40-setup-ssh
index 0913425..8be8d07 100755
--- a/elements/hadoop_fedora/install.d/40-setup-ssh
+++ b/elements/hadoop_fedora/install.d/40-setup-ssh
@@ -6,6 +6,7 @@ echo "Adjusting ssh configuration"
6# /etc/ssh/ssh_config is provided by openssh-clients 6# /etc/ssh/ssh_config is provided by openssh-clients
7# Note0: augtool is provided by augeas-tools on Ubuntu 7# Note0: augtool is provided by augeas-tools on Ubuntu
8# Note1: augtool on Ubuntu does not auto-save, pass -s 8# Note1: augtool on Ubuntu does not auto-save, pass -s
9# Note2: openssh-clients is openssh-client on Ubuntu
9install-packages augeas openssh-server openssh-clients 10install-packages augeas openssh-server openssh-clients
10 11
11 12