From 5aa8fc7fa6a09f219f704d301541b213b9aa07c8 Mon Sep 17 00:00:00 2001 From: Vincent Date: Tue, 5 Jun 2018 16:29:07 -0400 Subject: [PATCH] Update the document regarding Open JDK and Oracle JDK (#3720) Our documents need to be changed to point according to the usage of Open JDK or Oracle JDK. This PR adds the instructions to install either of them as the Java environment of OpenWhisk. Partially-closes: apache/incubator-openwhisk-release#169 --- README.md | 2 ++ tools/macos/README.md | 20 +++++++++++++++++++- tools/ubuntu-setup/README.md | 11 +++++++++++ tools/ubuntu-setup/all.sh | 5 ++++- tools/ubuntu-setup/java8.sh | 18 ++++++++++++++---- tools/vagrant/Vagrantfile | 2 +- 6 files changed, 51 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 172580c17cb..842178f8170 100644 --- a/README.md +++ b/README.md @@ -75,6 +75,8 @@ wsk action invoke /whisk.system/utils/echo -p message hello --result These steps were tested on Mac OS X El Capitan, Ubuntu 14.04.3 LTS and Windows using Vagrant. For more information about using OpenWhisk on Vagrant see the [tools/vagrant/README.md](tools/vagrant/README.md) +During the Vagrant setup, Open JDK 8 is used as the default Java environment. If you would like to use Oracle JDK 8, please change the line "su vagrant -c 'source all.sh'" into "su vagrant -c 'source all.sh oracle'" in tools/vagrant/Vagrantfile. + ### Native development Docker must be natively installed in order to build and deploy OpenWhisk. diff --git a/tools/macos/README.md b/tools/macos/README.md index 4298b581f20..c4cef3a3c50 100644 --- a/tools/macos/README.md +++ b/tools/macos/README.md @@ -27,7 +27,7 @@ If you prefer to use Docker-machine, you can follow instructions in [docker-mach The following are required to build and deploy OpenWhisk from a Mac host: - [Docker 1.12.0](https://docs.docker.com/docker-for-mac/) -- [Java 8](http://www.oracle.com/technetwork/java/javase/downloads/index.html) +- [Java 8](http://www.oracle.com/technetwork/java/javase/downloads/index.html) or [Open JDK 8](https://adoptopenjdk.net/releases.html#x64_mac) - [Scala 2.11](http://scala-lang.org/download/) - [Ansible 2.5.2](http://docs.ansible.com/ansible/intro_installation.html) @@ -54,6 +54,24 @@ sudo easy_install pip sudo -H pip install docker==2.2.1 ansible==2.5.2 jinja2==2.9.6 couchdb==1.1 httplib2==0.9.2 requests==2.10.0' | bash ``` +The above section of command installs Oracle JDK 8 as the default Java environment. If you would like to install Open JDK 8 instead of Oracle JDK 8, please run the following section. + +``` +echo ' +# install homebrew +/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" +# install for finding alternative versions (Open JDK 8) +brew tap AdoptOpenJDK/openjdk +# install Open JDK 8 +brew install adoptopenjdk-openjdk8 +# install scala +brew install scala +# install pip +sudo easy_install pip +# install script prerequisites +sudo -H pip install docker==2.2.1 ansible==2.5.2 jinja2==2.9.6 couchdb==1.1 httplib2==0.9.2 requests==2.10.0' | bash +``` + # Build ``` cd /your/path/to/openwhisk diff --git a/tools/ubuntu-setup/README.md b/tools/ubuntu-setup/README.md index e563beb3ecc..ceabcd731f8 100644 --- a/tools/ubuntu-setup/README.md +++ b/tools/ubuntu-setup/README.md @@ -32,11 +32,22 @@ The commands below should be executed on the host machine for single VM/server d # Change current directory to openwhisk cd openwhisk + ``` + +Open JDK 8 is installed by running the following script as the default Java environment. + ``` # Install all required software (cd tools/ubuntu-setup && ./all.sh) ``` +If you choose to install Oracle JDK 8 instead of Open JDK 8, please run the following script. + + ``` + # Install all required software + (cd tools/ubuntu-setup && ./all.sh oracle) + ``` + If you are deploying OpenWhisk in a distributed environment across multiple VMs, then follow the instructions in [ansible/README_DISTRIBUTED.md](../../ansible/README_DISTRIBUTED.md) to complete the deployment. Otherwise, continue with the instructions below. ### Select a data store diff --git a/tools/ubuntu-setup/all.sh b/tools/ubuntu-setup/all.sh index 2f84d5789d3..21a37ff9c00 100755 --- a/tools/ubuntu-setup/all.sh +++ b/tools/ubuntu-setup/all.sh @@ -25,6 +25,9 @@ set -e set -x + +JAVA_SOURCE=${1:-"open"} + SOURCE="${BASH_SOURCE[0]}" SCRIPTDIR="$( dirname "$SOURCE" )" @@ -35,7 +38,7 @@ echo "*** installing python dependences" /bin/bash "$SCRIPTDIR/pip.sh" echo "*** installing java" -/bin/bash "$SCRIPTDIR/java8.sh" +/bin/bash "$SCRIPTDIR/java8.sh" $JAVA_SOURCE echo "*** installing ansible" /bin/bash "$SCRIPTDIR/ansible.sh" diff --git a/tools/ubuntu-setup/java8.sh b/tools/ubuntu-setup/java8.sh index 73770f4e01f..bda70909476 100755 --- a/tools/ubuntu-setup/java8.sh +++ b/tools/ubuntu-setup/java8.sh @@ -19,10 +19,20 @@ set -e set -x -if [ "$(lsb_release -cs)" == "trusty" ]; then +JAVA_SOURCE=${1:-"open"} + +if [ "$JAVA_SOURCE" != "oracle" ] ; then + if [ "$(lsb_release -cs)" == "trusty" ]; then + sudo apt-get install -y software-properties-common python-software-properties + sudo add-apt-repository ppa:jonathonf/openjdk -y + sudo apt-get update + fi + + sudo apt-get install openjdk-8-jdk -y +else sudo apt-get install -y software-properties-common python-software-properties - sudo add-apt-repository ppa:jonathonf/openjdk -y + sudo add-apt-repository ppa:webupd8team/java -y sudo apt-get update -fi -sudo apt-get install openjdk-8-jdk -y + sudo apt-get install oracle-java8-installer -y +fi diff --git a/tools/vagrant/Vagrantfile b/tools/vagrant/Vagrantfile index 2494dd98a5b..77764a5e84a 100644 --- a/tools/vagrant/Vagrantfile +++ b/tools/vagrant/Vagrantfile @@ -87,7 +87,7 @@ Vagrant.configure('2') do |config| echo PATH=${PATH}:${HOME}/bin:${OPENWHISK_HOME}/tools/build >> /etc/environment cd ${OPENWHISK_HOME} cd tools/ubuntu-setup - su vagrant -c 'source all.sh' + su vagrant -c 'source all.sh oracle' echo "`date`: ubuntu-setup-end" >> /tmp/vagrant-times.txt SCRIPT