As every Oracle WebLogic system administrator would pass through this situation but only few of them who have "AUTOMATION IN MINDS" could attempt to resolve this with a nicely blended Shell script.
Here I would like to target two types of installations with two different Shell scripts:
- Fusion Middleware 12.2.1.2.0 WebLogic Server installation
- Fusion Middleware 12.2.1.2.0 Infrastructure installation
Objective of this script is to get single hit would do multiple tasks such as:
- JAVA installation
- setting the JAVA_HOME in shell profile
- using Java run the WebLogic installer in silent mode
YOu can use the same logic in WebLogic 14c the latest version as well.
Assumptions:
- Downloaded Software will be stored in common shared location.
- Installation of software such as JDK, WebLogic will be same mount point and directory structure
- Linux Operating System user have bash shell!
Knowledge base:
Auto Install pre-requisite for Application - Script
Auto Install pre-requisite for Application - Script
wls.cfg
Script name: install_wls.sh
JDK_INSTALLER=jdk-8u*-linux-x64.tar.gz JDK_INSTALLER_PATH=/u01/app/software/jdk INSTAL_LOC=/u01/app/oracle WLS_INSTALLER=fmw_12.*_wls.jar WLS_INSTALLER_PATH=/u01/app/software/FMW_wls SILENT_DIR=/u01/app/software/silent
Script name: install_wls.sh
#!/bin/bash # This script will be installing JDK # installing WebLogic in silent mode # #- Info #- Author : Pavan Devarakonda #- Date : 30-March-2017 ############################################## . wls.cfg echo "installing JDK ${JDK_INSTALLER}" cd $INSTAL_LOC tar -zxvf $JDK_INSTALLER_PATH/$JDK_INSTALLER ls -l echo confirm JDK installation cd $INSTAL_LOC/jdk* JAVA_HOME=`pwd` echo "export JAVA_HOME=$JAVA_HOME">>$HOME/.bashrc echo "export PATH=$JAVA_HOME/bin:$PATH">>$HOME/.bashrc . $HOME/.bashrc echo "Check for java version" java -version echo Installing WebLogic now... echo . java -jar $WLS_INSTALLER_PATH/$WLS_INSTALLER -silent -invPtrLoc $SILENT_DIR/oraInst.loc -responseFile $SILENT_DIR/wls_install.rsp echo "WebLogic $WLS_INSTALLER installed successfully...." echo . echo setting MW_HOME ... MW_HOME=`grep ORACLE_HOME $SILENT_DIR/wls_install.rsp |cut -d'=' -f2` echo "export MW_HOME=$MW_HOME">>$HOME/.bashrc echo "export WL_HOME=$MW_HOME/wlserver">>$HOME/.bashrc echo "alias wlst=$MW_HOME/oracle_common/common/bin/wlst.sh">>$HOME/.bashrc . $HOME/.bashrc echo "Use wlst command to test everything working..."
Oracle Fusion Middleware Infrastructure installation Shell Script
Here the script is little bit improved the installer normally coming as zip file which can be uncompressed by script and also silent file will be usingINSTALL_TYPE=Fusion Middleware Infrastructure With ExamplesNow the script for Infrastructure will be look like this.
#!/bin/bash # This script will be installing JDK # installing WebLogic in silent mode # JDK_INSTALLER=jdk-8u121-linux-x64.tar.gz JDK_INSTALLER_PATH=/u01/app/software/jdk INSTAL_LOC=/u01/app/oracle echo "installing JDK ${JDK_INSTALLER}" cd $INSTAL_LOC tar -zxvf $JDK_INSTALLER_PATH/$JDK_INSTALLER ls -l echo confirm JDK installation cd $INSTAL_LOC/jdk* JAVA_HOME=`pwd` echo "export JAVA_HOME=$JAVA_HOME">>$HOME/.bashrc echo "export PATH=$JAVA_HOME/bin:$PATH">>$HOME/.bashrc . $HOME/.bashrc echo "Check for java version" java -version echo Installing WebLogic now... echo . WLS_INSTALLER=fmw_12.2.1.2.0_infrastructure_Disk1_1of1.zip WLS_INSTALLER_PATH=/u01/app/software/FMW_wls cd $WLS_INSTALLER_PATH unzip $WLS_INSTALLER_PATH/$WLS_INSTALLER INFRA_JAR=fmw_12.2.1.2.0_infrastructure.jar SILENT_DIR=/u01/app/software/silent java -jar $WLS_INSTALLER_PATH/$INFRA_JAR -silent -invPtrLoc $SILENT_DIR/oraInst.loc -responseFile $SILENT_DIR/fmw12.2.1_infra_install.rsp echo "FMW Infrastructure $WLS_INSTALLER installed successfully...." echo . echo setting MW_HOME ... MW_HOME=`grep ORACLE_HOME $SILENT_DIR/$SILENT_DIR/fmw12.2.1_infra_install.rsp |cut -d'=' -f2` echo "export MW_HOME=$MW_HOME">>$HOME/.bashrc echo "export WL_HOME=$MW_HOME/wlserver">>$HOME/.bashrc echo "alias wlst=$MW_HOME/oracle_common/common/bin/wlst.sh">>$HOME/.bashrc . $HOME/.bashrc echo "Use wlst command to test everything working..."Note: If you are running other than Linux platform you can use ksh shell .profile.
keep in touch with your comment and suggestions for improve more effective way.
cheers!!!
Thanks Pavan, for sharing your technical expertise with others. The blog is straight forward and pretty much easy to understand and implement. The pace at which the industry is running to achieve devops culture, it is very much the need of the hour. The end user or a developer just clicks a button and the environment setup is ready!
ReplyDeletethanks for this amazing blog , keep posting and checkout my blog full stack java classes in pune
ReplyDelete