You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@impala.apache.org by ta...@apache.org on 2019/04/04 17:09:18 UTC

[impala] 03/04: IMPALA-6826: Extend bootstrap_system.sh to Ubuntu 18.04

This is an automated email from the ASF dual-hosted git repository.

tarmstrong pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/impala.git

commit 5771c45a21450e49fd2d969a8218bbc62f5530b0
Author: Laszlo Gaal <la...@cloudera.com>
AuthorDate: Sun Jan 27 22:40:08 2019 +0100

    IMPALA-6826: Extend bootstrap_system.sh to Ubuntu 18.04
    
    Tweak bin/bootstrap_system.sh to automate the preparation of
    an Impala development environment on Ubuntu 18.04.
    The following changes were required:
    - extend the OS recognition logic to Ubuntu 18.04
    - add 'ant' to the list of installed packages
    - request OpenJDK 8 as the default Java environment (Ubuntu 18.04
      defaults to OpenJDK 11)
    
    These changes enable bootstrap_system.sh to set up an Impala development
    environment where Impala can be successfully built.
    
    Note that the patch does not attempt to pass the tests yet; this change
    prepares only the environment. Bugs specific to Ubuntu 18 will be fixed
    by follow-up commits.
    
    Tested in the following environments:
    - in a Docker container, using
        "docker/test-with-docker.py --base-image:ubuntu:18.04"
    - on an AWS EC2 m5.4xlarge instance
    
    Change-Id: Iad790f72ea6b62258aed2225eb7bdf79590c350f
    Reviewed-on: http://gerrit.cloudera.org:8080/12893
    Reviewed-by: Impala Public Jenkins <im...@cloudera.com>
    Tested-by: Impala Public Jenkins <im...@cloudera.com>
---
 bin/bootstrap_system.sh | 50 +++++++++++++++++++++++++++++++++++++++----------
 1 file changed, 40 insertions(+), 10 deletions(-)

diff --git a/bin/bootstrap_system.sh b/bin/bootstrap_system.sh
index 2297f2d..af43a26 100755
--- a/bin/bootstrap_system.sh
+++ b/bin/bootstrap_system.sh
@@ -72,6 +72,8 @@ REDHAT=
 REDHAT6=
 REDHAT7=
 UBUNTU=
+UBUNTU16=
+UBUNTU18=
 IN_DOCKER=
 if [[ -f /etc/redhat-release ]]; then
   REDHAT=true
@@ -87,18 +89,28 @@ if [[ -f /etc/redhat-release ]]; then
   # TODO: restrict redhat versions
 else
   source /etc/lsb-release
-  if ! [[ $DISTRIB_ID = Ubuntu ]]
+  if [[ $DISTRIB_ID = Ubuntu ]]
   then
+    UBUNTU=true
+    echo "Identified Ubuntu system."
+    # Kerberos setup would pop up dialog boxes without this
+    export DEBIAN_FRONTEND=noninteractive
+    if [[ $DISTRIB_RELEASE = 16.04 ]]
+    then
+      UBUNTU16=true
+      echo "Identified Ubuntu 16.04 system."
+    elif [[ $DISTRIB_RELEASE = 18.04 ]]
+    then
+      UBUNTU18=true
+      echo "Identified Ubuntu 18.04 system."
+    else
+      echo "This script only supports 16.04 or 18.04 of Ubuntu" >&2
+      exit 1
+    fi
+  else
     echo "This script only supports Ubuntu or RedHat" >&2
     exit 1
   fi
-  if ! [[ $DISTRIB_RELEASE = 16.04 ]]
-  then
-    echo "This script only supports 16.04 of Ubuntu" >&2
-    exit 1
-  fi
-  UBUNTU=true
-  export DEBIAN_FRONTEND=noninteractive
 fi
 if grep docker /proc/1/cgroup; then
   IN_DOCKER=true
@@ -112,6 +124,20 @@ function ubuntu {
   fi
 }
 
+# Helper function to execute following command only on Ubuntu 16.04
+function ubuntu16 {
+  if [[ "$UBUNTU16" == true ]]; then
+    "$@"
+  fi
+}
+
+# Helper function to execute following command only on Ubuntu 18.04
+function ubuntu18 {
+  if [[ "$UBUNTU18" == true ]]; then
+    "$@"
+  fi
+}
+
 # Helper function to execute following command only on RedHat
 function redhat {
   if [[ "$REDHAT" == true ]]; then
@@ -165,7 +191,7 @@ ubuntu apt-get --yes install ccache g++ gcc libffi-dev liblzo2-dev libkrb5-dev \
         krb5-admin-server krb5-kdc krb5-user libsasl2-dev libsasl2-modules \
         libsasl2-modules-gssapi-mit libssl-dev make maven ninja-build ntp \
         ntpdate python-dev python-setuptools postgresql ssh wget vim-common psmisc \
-        lsof openjdk-8-jdk openjdk-8-source openjdk-8-dbg apt-utils git
+        lsof openjdk-8-jdk openjdk-8-source openjdk-8-dbg apt-utils git ant
 
 if [[ "$UBUNTU" == true ]]; then
   # Don't use openjdk-8-jdk 8u181-b13-1ubuntu0.16.04.1 which is known to break the
@@ -189,6 +215,10 @@ if [[ "$UBUNTU" == true ]]; then
   fi
 fi
 
+# Ubuntu 18.04 installs OpenJDK 11 and configures it as the default Java version.
+# Impala is currently tested with OpenJDK 8, so configure that version as the default.
+ubuntu18 sudo update-java-alternatives -s java-1.8.0-openjdk-amd64
+
 
 redhat sudo yum install -y curl gcc gcc-c++ git krb5-devel krb5-server krb5-workstation \
         libevent-devel libffi-devel make ntp ntpdate ntp-perl openssl-devel cyrus-sasl \
@@ -252,7 +282,7 @@ redhat6 sudo service ntpd start || grep docker /proc/1/cgroup
 notindocker redhat7 sudo service ntpd start
 
 # IMPALA-3932, IMPALA-3926
-if [[ $UBUNTU = true && $DISTRIB_RELEASE = 16.04 ]]
+if [[ $UBUNTU = true && ( $DISTRIB_RELEASE = 16.04 || $DISTRIB_RELEASE = 18.04 ) ]]
 then
   SET_LD_LIBRARY_PATH='export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}'
   echo -e "\n$SET_LD_LIBRARY_PATH" >> "${IMPALA_HOME}/bin/impala-config-local.sh"