Silent Installation and Configuration of Standalone Oracle HTTP Server

Posted by Dirk Nachbar on Monday, April 10, 2017
Currently I am working in a project for which will be needed the Oracle HTTP Server (OHS) in a Standalone Mode as a frontend Web Server for a Oracle SOA 12.2.1.2.0 environment.

As I am not really a fan of clicking through several installers and configuration wizards, I have created some scripts for a complete silent installation of the Standalone Oracle HTTP Server 12.2.1.2.0 and on top a silent configuration of the standalone Domain for the Oracle HTTP Server.

Silent Installation of the Oracle HTTP Server Software

For the following example, we will use following naming convention:
  • MW_HOME=/u00/app/oracle/product/fmw-webtier-12.2.1.2.0
  • JAVA_HOME=/u00/app/oracle/product/jdk1.8.0_121
  • DOMAIN_HOME=/u00/app/oracle/user_projects/domains/ohs_domain
Download at first the required installation software from Oracle Technology Network http://www.oracle.com/technetwork/middleware/webtier/downloads/index.html and transfer the installation software to your target server, e.g. /u00/app/oracle/tmp.


Make sure you that you have a JDK 1.8 on your server, I prefer to install the JDK under the Oracle user, e.g. /u00/app/oracle/product/jdk1.8.0_121

Connect to your server as oracle user and create following files under the directory /u00/app/oracle/tmp

webtier.rsp
[ENGINE]
Response File Version=1.0.0.0.0
[GENERIC]
ORACLE_HOME=/u00/app/oracle/product/fmw-webtier-12.2.1.2.0
INSTALL_TYPE=Standalone HTTP Server (Managed independently of WebLogic server)
DECLINE_SECURITY_UPDATES=true
SECURITY_UPDATES_VIA_MYORACLESUPPORT=false

oraInst.loc
inst_group=oinstall
inventory_loc=/u00/app/oracle/oraInventory

Now we can extract the installation software and install the Oracle HTTP Server in silent mode
oracle@server> cd /u00/app/oracle/tmp
oracle@server> unzip fmw_12.2.1.2.0_ohs_linux64_Disk1_1of1.zip
oracle@server> ./fmw_12.2.1.2.0_ohs_linux64.bin -jreLoc /u00/app/oracle/product/jdk1.8.0_121 -silent -responseFile /u00/app/oracle/tmp/webtier.rsp -invPtrLoc /u00/app/oracle/tmp/oraInst.loc

0%...................................................................................................100%
Launcher log file is /tmp/OraInstall2017-04-10_12-39-12PM/launcher2017-04-10_12-39-12PM.log.
Checking if CPU speed is above 300 MHz.   Actual 2194.918 MHz    Passed
Checking swap space: must be greater than 512 MB.   Actual 3071 MB    Passed
Checking if this platform requires a 64-bit JVM.   Actual 64    Passed (64-bit not required)
Checking temp space: must be greater than 300 MB.   Actual 8528 MB    Passed
. . .
. . .
Percent Complete : 90
Visit http://www.oracle.com/support/policies.html for Oracle Technical Support policies.
Percent Complete : 100

The installation of Oracle HTTP Server 12.2.1.2.0 completed successfully.
Logs successfully copied to /u00/app/oracle/oraInventory/logs.

Now we have installed the Oracle HTTP Server Software.

Silent Configuration of the Standalone Domain for the Oracle HTTP Server

The next step is to configure in a silent way the required Standalone Domain for our Oracle HTTP Server.

For this I have 3 scripts:

  • setLocalEnv.sh = contains all necessary Environment Variables for the creation of the Standalone Domain
  • cr_ohs_domain.sh = Wrapper Script to source the setLocalEnv.sh and execute the cr_ohs_domain.py
  • cr_ohs_domain.py = Python Script to create the Standalone Domain for the Oracle HTTP Server

setLocalEnv.sh
#
# Author: Dirk Nachbar
#
# http://dirknachbar.blogspot.com
#
# Environment Script for silent Standalone OHS Domain Creation
# 
#
export SCRIPT_HOME=$PWD
export MW_HOME=/u00/app/oracle/product/fmw-webtier-12.2.1.2.0
export WLST_HOME=$MW_HOME/oracle_common/common/bin
export JAVA_HOME=/u00/app/oracle/product/jdk1.8.0_121
export DOMAIN_NAME=ohs_domain
export DOMAIN_HOME=/u00/app/oracle/user_projects/domains/$DOMAIN_NAME
export NM_LISTENADDRESS=`hostname -f`
export NM_TYPE=SSL
export NM_PORT=5557
export NM_USERNAME=nodemanager
export NM_PASSWORD=welcome1
export NM_HOME=$DOMAIN_HOME/nodemanager
export OHSINSTANCENAME=ohs1
export OHSADMINPORT=9999
export OHSHTTPPORT=7777
export OHSHTTPSPORT=4443

The above Environment Variables are all self-explained, you may align them to your specific needs.
cr_ohs_domain.sh
#!/bin/sh
#
# Author: Dirk Nachbar
#
# http://dirknachbar.blogspot.com
#
# Shell Script Wrapper for Silent Standalone OHS Domain Creation
#

start_time=$(date +%s)

. $PWD/setLocalEnv.sh

echo "============================================="
echo " Program: cr_ohs_domain.sh              ....."
echo "============================================="

if [ -z "${WLST_HOME}" ]; then
   echo " Environment not correctly set - please verify"
   exit 1
fi

if ! test -d "${DOMAIN_HOME}"; then
   echo "============================================="
   echo " Domain will be installed               ....."
   echo "============================================="
   if [ -z "${MW_HOME}" -o -z "${JAVA_HOME}" -o -z "${DOMAIN_NAME}" -o -z "${DOMAIN_HOME}" -o -z "${NM_LISTENADDRESS}" -o -z "${NM_TYPE}" -o -z "${NM_PORT}" -o -z "${NM_USERNAME}" -o -z "${NM_PASSWORD}" -o -z "${NM_HOME}" -o -z "${OHSADMINPORT}" -o -z "${OHSHTTPPORT}" -o -z "${OHSHTTPSPORT}" ]; then
      echo " Environment not set - Exit"
      exit 1
   fi

   # In case we are facing problems with /dev/random
   export CONFIG_JVM_ARGS=-Djava.security.egd=file:/dev/./urandom:$CONFIG_JVM_ARGS

   ${WLST_HOME}/wlst.sh ${SCRIPT_HOME}/cr_ohs_domain.py

   # Set End Time
   finish_time=$(date +%s)
   echo "Finished"
   echo "Domain Build Time: $(( $((finish_time - start_time))/60))  minutes."
 else
   echo "Domain is already installed ..."
fi

cr_ohs_domain.py
#!/usr/bin/python
#
# Author: Dirk Nachbar
#
# http://dirknachbar.blogspot.com
#

import os, sys

v_mwHome=os.environ['MW_HOME']
v_jdkHome=os.environ['JAVA_HOME']
v_domainHome=os.environ['DOMAIN_HOME']
v_domainName=os.environ['DOMAIN_NAME']
v_NMUsername=os.environ['NM_USERNAME']
v_NMPassword=os.environ['NM_PASSWORD']
v_NMHome=os.environ['NM_HOME']
v_NMHost=os.environ['NM_LISTENADDRESS']
v_NMPort=os.environ['NM_PORT']
v_NMType=os.environ['NM_TYPE']
v_OHSInstanceName=os.environ['OHSINSTANCENAME']
v_OHSAdminPort=os.environ['OHSADMINPORT']
v_OHSHTTPPort=os.environ['OHSHTTPPORT']
v_OHSHTTPSPort=os.environ['OHSHTTPSPORT']

readTemplate(v_mwHome +'/wlserver/common/templates/wls/base_standalone.jar')
addTemplate(v_mwHome +'/ohs/common/templates/wls/ohs_standalone_template.jar')

cd('/')
create(v_domainName, 'SecurityConfiguration') 
cd('SecurityConfiguration/' + v_domainName)
set('NodeManagerUsername',v_NMUsername)
set('NodeManagerPasswordEncrypted',v_NMPassword)
setOption('NodeManagerType', 'CustomLocationNodeManager');
setOption('NodeManagerHome', v_NMHome);
setOption('JavaHome', v_jdkHome )

cd('/Machines/localmachine/NodeManager/localmachine')
cmo.setListenAddress(v_NMHost);
cmo.setListenPort(int(v_NMPort));
cmo.setNMType(v_NMType);

delete(v_OHSInstanceName,'SystemComponent')
create (v_OHSInstanceName,'SystemComponent')
cd('/OHS/'+v_OHSInstanceName)
cmo.setAdminPort(v_OHSAdminPort)
cmo.setListenPort(v_OHSHTTPPort)
cmo.setSSLListenPort(v_OHSHTTPSPort)

writeDomain(v_domainHome) 

Now we can execute the cr_ohs_domain.sh which will create silently the Standalone Domain for our Oracle HTTP Server:

oracle@server> cd /u00/app/oracle/tmp
./cr_ohs_domain.sh

=============================================
 Program: cr_ohs_domain.sh              .....
=============================================
=============================================
 Domain will be installed               .....
=============================================

Initializing WebLogic Scripting Tool (WLST) ...

Welcome to WebLogic Server Administration Scripting Shell

Type help() for help on available commands

Finished
Domain Build Time: 1  minutes.

And thats it, now you can start your Oracle HTTP Server Instance named ohs1

oracle@server> cd /u00/app/oracle/user_projects/domains/ohs_domain/bin
oracle@server> ./startNodeManager > /dev/null 2>&1 &
oracle@server> ./startComponent.sh ohs1 storeUserConfig



Categories: