Date Created: Mon 08-Aug-2011

Get my WebSphere Application Server course here >> http://www.themiddlewareshop.com/products/



    WebSphere Automation Install Script for installing base binaries

    This script will show you how to install WebSphere binaries using configuration files and simplified response files. It is by no means complete, but goes a log way to doing the job in a repeatable fashion. It is still work in progress. Feel free to comment on our blog http://blog.screv.com or discuss in our forum: http://forum.webspheretools.com.

    This script was based on WebSphere 6.1, though with a little adjustment it will run on WAS 7. For WAS 8 there is a different process.

    (For WAS 8 consult this link: WebSphere slient install using IBM Installation Manager)


    Supporting Props Files:

    dmgr61.propsnode6101.propsnode6102.props

    Master Script:

    install.sh

    Sample Upgrade Installer Response Files:

    dmgr61_upgrade.txtnode6102_upgrade.txt

    Sample Installer Response Files

    responsefile.base_dmgr61.txtresponsefile.base_node6101.txtresponsefile.base_node6102.txtresponsefile.updiinstaller.txt

    Sample command line for uninstall of binary files using the attached install.sh script.

    ./install.sh -t dmgr -f /home/was/scripts/dmgr61.props -u true
    ./install.sh -t node -f /home/was/scripts/node6101.props -u true
    ./install.sh -t node -f /home/was/scripts/node6102.props -u true

    Sample command line for install of WebSphere binary files using the attached install.sh script.

    ./install.sh -t dmgr -f /home/was/scripts/dmgr61.props -r /home/was/scripts/responsefile.base_dmgr61.txt

    ./install.sh -t node -f /home/was/scripts/node6101.props -r /home/was/scripts/responsefile.base_node6101.txt

    ./install.sh -t node -f /home/was/scripts/node6102.props -r /home/was/scripts/responsefile.base_node6102.txt

    Sample Command Line for an Upgrade installer using the attached install.sh script.

    ./install.sh -t node -f /home/was/scripts/node6101.props -r /home/was/scripts/node6101_upgrade.txt -g true

    The script:

    #!/bin/bash
    # Init
    FILE="/tmp/out.$$"
    GREP="/bin/grep"
    # Make sure only root can run our script
    if [ "$(id -u)" != "0" ]; then
    echo "The script [$0] must be run as root" 1>&2
    exit 1
    fi

    getVars ()
    {

    export CELL_NAME=`sed '/^\#/d' ${PROPS_FILE} | grep 'CELL_NAME' | tail -n 1 | cut -d "=" -f2- | sed 's/^[[:space:]]*//;s/[[:space:]]*$//'`
    export ENV=`sed '/^\#/d' ${PROPS_FILE} | grep 'ENV' | tail -n 1 | cut -d "=" -f2- | sed 's/^[[:space:]]*//;s/[[:space:]]*$//'`
    export HOST=`sed '/^\#/d' ${PROPS_FILE} | grep 'HOST' | tail -n 1 | cut -d "=" -f2- | sed 's/^[[:space:]]*//;s/[[:space:]]*$//'`
    export DMGR_HOST=`sed '/^\#/d' ${PROPS_FILE} | grep 'DMGR_HOST' | tail -n 1 | cut -d "=" -f2- | sed 's/^[[:space:]]*//;s/[[:space:]]*$//'`
    export PROFILE_NAME=`sed '/^\#/d' ${PROPS_FILE} | grep 'PROFILE_NAME' | tail -n 1 | cut -d "=" -f2- | sed 's/^[[:space:]]*//;s/[[:space:]]*$//'`
    export NODE_NAME=`sed '/^\#/d' ${PROPS_FILE} | grep 'NODE_NAME' | tail -n 1 | cut -d "=" -f2- | sed 's/^[[:space:]]*//;s/[[:space:]]*$//'`
    export START_PORT=`sed '/^\#/d' ${PROPS_FILE} | grep 'START_PORT' | tail -n 1 | cut -d "=" -f2- | sed 's/^[[:space:]]*//;s/[[:space:]]*$//'`
    export DMGR_SOAP_PORT=`sed '/^\#/d' ${PROPS_FILE} | grep 'DMGR_SOAP_PORT' | tail -n 1 | cut -d "=" -f2- | sed 's/^[[:space:]]*//;s/[[:space:]]*$//'`
    export ROOT_DIR=`sed '/^\#/d' ${PROPS_FILE} | grep 'ROOT_DIR' | tail -n 1 | cut -d "=" -f2- | sed 's/^[[:space:]]*//;s/[[:space:]]*$//'`
    export INSTALLER_SRC_DIR=`sed '/^\#/d' ${PROPS_FILE} | grep 'INSTALLER_SRC_DIR' | tail -n 1 | cut -d "=" -f2- | sed 's/^[[:space:]]*//;s/[[:space:]]*$//'`
    export INSTALLER_CMD=`sed '/^\#/d' ${PROPS_FILE} | grep 'INSTALLER_CMD' | tail -n 1 | cut -d "=" -f2- | sed 's/^[[:space:]]*//;s/[[:space:]]*$//'`
    export INSTALLER_PARAM=`sed '/^\#/d' ${PROPS_FILE} | grep 'INSTALLER_PARAM' | tail -n 1 | cut -d "=" -f2- | sed 's/^[[:space:]]*//;s/[[:space:]]*$//'`
    export INSTALLER_LOG=`sed '/^\#/d' ${PROPS_FILE} | grep 'INSTALLER_LOG' | tail -n 1 | cut -d "=" -f2- | sed 's/^[[:space:]]*//;s/[[:space:]]*$//'`
    export UNINSTALL_CMD=`sed '/^\#/d' ${PROPS_FILE} | grep 'UNINSTALL_CMD' | tail -n 1 | cut -d "=" -f2- | sed 's/^[[:space:]]*//;s/[[:space:]]*$//'`
    export UNINSTALL_PARAM=`sed '/^\#/d' ${PROPS_FILE} | grep 'UNINSTALL_PARAM' | tail -n 1 | cut -d "=" -f2- | sed 's/^[[:space:]]*//;s/[[:space:]]*$//'`
    export UNINSTALL_LOG=`sed '/^\#/d' ${PROPS_FILE} | grep 'UNINSTALL_LOG' | tail -n 1 | cut -d "=" -f2- | sed 's/^[[:space:]]*//;s/[[:space:]]*$//'`
    export SCRIPT_DIR=`sed '/^\#/d' ${PROPS_FILE} | grep 'SCRIPT_DIR' | tail -n 1 | cut -d "=" -f2- | sed 's/^[[:space:]]*//;s/[[:space:]]*$//'`
    export UI_INSTALLER_SRC_DIR=`sed '/^\#/d' ${PROPS_FILE} | grep 'UI_INSTALLER_SRC_DIR' | tail -n 1 | cut -d "=" -f2- | sed 's/^[[:space:]]*//;s/[[:space:]]*$//'`
    export UI_INSTALLER_CMD=`sed '/^\#/d' ${PROPS_FILE} | grep 'UI_INSTALLER_CMD' | tail -n 1 | cut -d "=" -f2- | sed 's/^[[:space:]]*//;s/[[:space:]]*$//'`
    export UI_INSTALLER_PARAM=`sed '/^\#/d' ${PROPS_FILE} | grep 'UI_INSTALLER_PARAM' | tail -n 1 | cut -d "=" -f2- | sed 's/^[[:space:]]*//;s/[[:space:]]*$//'`
    export FP_INSTALLER_PATH=`sed '/^\#/d' ${PROPS_FILE} | grep 'FP_INSTALLER_PATH' | tail -n 1 | cut -d "=" -f2- | sed 's/^[[:space:]]*//;s/[[:space:]]*$//'`
    export FP_INSTALLER_CMD=`sed '/^\#/d' ${PROPS_FILE} | grep 'FP_INSTALLER_CMD' | tail -n 1 | cut -d "=" -f2- | sed 's/^[[:space:]]*//;s/[[:space:]]*$//'`
    export FP_INSTALLER_PARAM=`sed '/^\#/d' ${PROPS_FILE} | grep 'FP_INSTALLER_PARAM' | tail -n 1 | cut -d "=" -f2- | sed 's/^[[:space:]]*//;s/[[:space:]]*$//'`
    }
    printVars()
    {
    ## Echo all properties found in the props file ##
    #WebSphere Specific Vars
    echo "CELL_NAME="${CELL_NAME}
    echo "ENV="${ENV}
    echo "HOST="${HOST}
    echo "PROFILE_NAME="${PROFILE_NAME}
    echo "NODE_NAME="${NODE_NAME}
    echo "START_PORT="${START_PORT}
    # Directories for target install
    echo "ROOT_DIR="${ROOT_DIR}
    # General Installer parameters
    echo "INSTALLER_SRC_DIR="${INSTALLER_SRC_DIR}
    echo "INSTALLER_CMD="${INSTALLER_CMD}
    echo "INSTALLER_PARAM="${INSTALLER_PARAM}
    # General Uninstaller parameters
    echo "UNINSTALL_CMD="${UNINSTALL_CMD}
    echo "UNINSTALL_PARAM="${UNINSTALL_PARAM}
    echo "UNINSTALL_LOG="${UNINSTALL_LOG}
    echo "UI_INSTALLER_SRC_DIR="${UI_INSTALLER_SRC_DIR}
    echo "UI_INSTALLER_CMD="${UNINSTALL_PARAM}
    echo "UI_INSTALLER_PARAM="${UI_INSTALLER_CMD}
    echo "FP_INSTALLER_PATH="${FP_INSTALLER_PATH}
    echo "FP_INSTALLER_CMD="${FP_INSTALLER_CMD}
    echo "FP_INSTALLER_PARAM="${FP_INSTALLER_PARAM}
    echo "SCRIPT_DIR="${SCRIPT_DIR}
    echo "TYPE="${TYPE}
    echo "RESPONSE_FILE="${RESPONSE_FILE}

    }

    queryExisting()
    {
    #Query existing installations
    export VERIFY_ROOT="/installRegistryUtils/bin"
    echo ${VERIFY_ROOT}

    export VERIFY_ENV_CMD="setInstallRegistryUtilsEnv.sh"
    echo ${VERIFY_ENV_CMD}

    export VERIFY_CMD="installRegistryUtils.sh -listProducts"
    echo ${VERIFY_CMD}

    echo "Setting up verify environment vars \"${INSTALLER_SRC_DIR}/$VERIFY_ROOT}/${VERIFY_ENV_CMD}\" from ${PWD}"
    ${INSTALLER_SRC_DIR}/${VERIFY_ROOT}/${VERIFY_ENV_CMD}

    echo "Running CMD \"${INSTALLER_SRC_DIR}/$VERIFY_ROOT}/${VERIFY_CMD}\" from ${PWD}"
    ${INSTALLER_SRC_DIR}/${VERIFY_ROOT}/${VERIFY_CMD}
    }

    create_DM_Profile()
    {
    #Create DMGR Profile
    cd ${ROOT_DIR}/${ENV}/bin
    echo "Running ${ROOT_DIR}/${ENV}/bin/manageprofiles.sh from ${PWD}"
    echo "Running CMD: ./manageprofiles.sh -create -profileName ${PROFILE_NAME} -profilePath ${ROOT_DIR}/${ENV}/profiles -templatePath ${ROOT_DIR}/${ENV}/profileTemplates/dmgr -cellName ${CELL_NAME} -hostName ${HOST} -nodeName ${NODE_NAME} -startingPort ${START_PORT} -isDefault -enableAdminSecurity true -adminUserName wasadmin -adminPassword wasadmin"
    ./manageprofiles.sh -create -profileName ${PROFILE_NAME} -profilePath ${ROOT_DIR}/${ENV}/profiles -templatePath ${ROOT_DIR}/${ENV}/profileTemplates/dmgr -cellName ${CELL_NAME} -hostName ${HOST} -nodeName ${NODE_NAME} -startingPort ${START_PORT} -isDefault -enableAdminSecurity true -adminUserName wasadmin -adminPassword wasadmin
    cat ${ROOT_DIR}/${ENV}/profiles/logs/AboutThisProfile.txt
    #chown -R was:was ${ROOT_DIR}
    }

    start_DM()
    {
    echo "If you are to add nodes, then start the Deployment Manager using ${ROOT_DIR}/${ENV}/bin/startManager.sh"
    }

    create_Node_Profile()
    {
    #Create Node Profile
    cd ${ROOT_DIR}/${ENV}/bin
    echo "Running ${ROOT_DIR}/${ENV}/bin/manageprofiles.sh from ${PWD}"
    echo "Running CMD: ./manageprofiles.sh -create -profileName ${PROFILE_NAME} -profilePath ${ROOT_DIR}/${ENV}/profiles -templatePath ${ROOT_DIR}/${ENV}/profileTemplates/managed -cellName ${CELL_NAME} -hostName ${HOST} -nodeName ${NODE_NAME} -startingPort ${START_PORT} -isDefault -enableAdminSecurity true -adminUserName wasadmin -adminPassword wasadmin -dmgrHost ${DMGR_HOST} -dmgrPort ${DMGR_SOAP_PORT} -dmgrAdminUserName wasadmin -dmgrAdminPassword wasadmin"
    ./manageprofiles.sh -create -profileName ${PROFILE_NAME} -profilePath ${ROOT_DIR}/${ENV}/profiles -templatePath ${ROOT_DIR}/${ENV}/profileTemplates/managed -cellName ${CELL_NAME} -hostName ${HOST} -nodeName ${NODE_NAME} -startingPort ${START_PORT} -isDefault -enableAdminSecurity true -adminUserName wasadmin -adminPassword wasadmin -dmgrHost ${DMGR_HOST} -dmgrPort ${DMGR_SOAP_PORT} -dmgrAdminUserName wasadmin -dmgrAdminPassword wasadmin
    cat ${ROOT_DIR}/${ENV}/profiles/logs/AboutThisProfile.txt
    #chown -R was:was ${ROOT_DIR}
    }

    start_Node()
    {
    echo "you can start the node using: ${ROOT_DIR}/${ENV}/bin/startNode.sh"
    }

    install_Binaries()
    {
    #Install a Depoyment Manager or node
    echo "cd ${INSTALLER_SRC_DIR}"
    cd ${INSTALLER_SRC_DIR}
    echo "Running silent install using \"${RESPONSE_FILE}\" from ${PWD}"
    echo "Running CMD: ${INSTALLER_CMD} -options ${RESPONSE_FILE} ${INSTALLER_PARAM}"
    ${INSTALLER_CMD} -options ${RESPONSE_FILE} ${INSTALLER_PARAM}
    echo "==============="
    cd ${ROOT_DIR}/${ENV}/
    tail ${INSTALLER_LOG}
    echo "==============="

    }

    uninstall_Binaries()
    {
    #Todo: Check is already uinstalled
    #Todo: Trap ./uninstall/uninstall: No such file or directory

    #Uninstall Deployment Manager
    cd ${ROOT_DIR}/${ENV}/
    echo "Running CMD: ${UNINSTALL_CMD} ${UNINSTALL_PARAM} from ${PWD}"
    ${UNINSTALL_CMD} ${UNINSTALL_PARAM}
    echo "==============="
    cd ${ROOT_DIR}/${ENV}/
    tail ${UNINSTALL_LOG}
    echo "==============="
    echo "Delete the folder ${ROOT_DIR}/${ENV} before you try an install into the same folder!"

    }

    InstallUpdateInstaller()
    {
    #Installs the latest update installer

    echo "cd ${UI_INSTALLER_SRC_DIR}"
    cd ${UI_INSTALLER_SRC_DIR}
    echo "Running silent install using \"${RESPONSE_FILE}\" from ${PWD}"
    echo "Running CMD: ${UI_INSTALLER_CMD} -options ${RESPONSE_FILE} ${UI_INSTALLER_PARAM}"
    ${UI_INSTALLER_CMD} -options ${RESPONSE_FILE} ${UI_INSTALLER_PARAM}
    }


    InstallFixPack()
    {
    #Installs the latest fixpack

    echo "cd ${FP_INSTALLER_PATH}"
    cd ${FP_INSTALLER_PATH}
    echo "Running silent install using \"${RESPONSE_FILE}\" from ${PWD}"
    echo "Running CMD: ${FP_INSTALLER_CMD} -options ${RESPONSE_FILE} ${FP_INSTALLER_PARAM}"
    ${FP_INSTALLER_CMD} -options ${RESPONSE_FILE} ${FP_INSTALLER_PARAM}
    }

    #############
    #### MAIN ###
    #############

    #Get command live variables
    while getopts "t:f:u:r:g:p:" flag
    do
    echo "$flag" $OPTIND $OPTARG
    case $flag in
    t) export TYPE="${OPTARG}";;
    f) export PROPS_FILE="${OPTARG}";;
    r) export RESPONSE_FILE="${OPTARG}";;
    g) export UPGRADE="${OPTARG}";;
    u) export UNINSTALL="${OPTARG}";;
    p) export ADD_PROFILE="${OPTARG}";;
    esac
    done

    if [ "<"${TYPE}">" = "<>" ]; then
    echo "An install type must be selected!"
    exit 1
    fi


    if [ "<"${PROPS_FILE}">" = "<>" ]; then
    echo "A props file containing environment settings must exist!"
    exit 1
    fi

    if [ "<"${ADD_PROFILE}">" != "<true>" ]; then
    if [ "<"${RESPONSE_FILE}">" = "<>" ]; then
    echo "A response file must exist!"
    exit 1
    fi
    fi

    #Source the properties from the props file:
    getVars
    printVars

    if [ "<"${UNINSTALL}">" = "<true>" ]; then
    uninstall_Binaries
    exit 0
    fi

    if [ "<"${TYPE}">" = "<dmgr>" ]; then

    if [ "<"${ADD_PROFILE}">" = "<true>" ]; then
    echo "creating a Deployment Manager profile"
    create_DM_Profile
    start_DM
    exit 0
    fi

    if [ "<"${UPGRADE}">" = "<true>" ]; then
    echo "installing the update installer"
    #InstallUpdateInstaller
    InstallFixPack
    else
    echo "A Depoyment Manager install has been chosen"
    install_Binaries
    fi



    #queryExisting

    else

    if [ "<"${ADD_PROFILE}">" = "<true>" ]; then
    echo "creating a node profile"
    create_Node_Profile
    start_Node
    exit 0
    fi

    if [ "<"${UPGRADE}">" = "<true>" ]; then
    echo "installing the update installer"
    #InstallUpdateInstaller
    InstallFixPack
    else
    echo "A Node install has been chosen"
    install_Binaries
    fi

    #queryExisting
    fi

    exit 0


    Result of a full install

    Login to the Administrative console of the WebSphere 6.1 Server and select "Node" from the "System administratoin" section of the left hand-side navigation menu.




    The result as you can see if the latest version of WebSphere 6.1 (ND 6.1.0.31) with a Deployment Manager and two nodes ready for a cluster and application deployment to that cluster.

Get my WebSphere Application Server course here >> http://www.themiddlewareshop.com/products/

Steve Robinson - IBM Champion 2013

About Me

Steve Robinson has been working in IT for over 20 years and has provided solutions for many large-enterprise corporate companies across the world. Steve specialises in Java and Middleware.

In January 2013, I was awarded the prestigous 'IBM Champion' accolade.


Read my books?

IBM WebSphere Application Server 8.0 Administration Guide

IBM WebSphere Application Server 8.0 Administration Guide

WebSphere Application Server 7.0 Administration Guide

WebSphere Application Server 7.0 Administration Guide

WebSphere Categories

Other Categories