weblogic12c静默安装
安装前的准备工作
编写weblogic12c静默安装脚本
创建脚本文件installWeblogic12c.sh
#!/usr/bin/env bash
# Author:fy
# Email:fy_xiaoer@126.com
# Date: 2020/1/17 8:43
# 记录当前运行脚本的路径
CURR_DIR="$(dirname $0)"
# 全局脚本的返回值
RETVAL=0
#=================================================================================
# 函数名称: usage
# 函数功能: 打印帮助信息,并退出程序
# 函数输出: 1
# 函数说明:
#=================================================================================
usage(){
# 帮助信息
cat <<- EOF
Usage: (bash|sh) $0 <wls.rsp> <oraInst.loc> <fmw_12.1.3.0.0_wls.jar> [<basicWLSDomain.py> <wlst.sh>]
wls.rsp rsp文件
oraInst.loc loc文件
fmw_12.1.3.0.0_wls.jar weblogic安装jar包
basicWLSDomain.py 域模板文件
./home/weblogic/Oracle/Middleware12/wlserver/common/bin/wlst.sh 创建目录的程序,绝对路径
EOF
exit 1
}
fileIsExist(){
if [[ ! -f $1 ]];then
echo "$1 文件不存在!"
exit 1
fi
}
#=================================================================================
# 函数名称: mian
# 函数功能: 主函数。
# 函数输出:
# 函数说明:
#=================================================================================
main(){
if [[ ${#@} -ne 0 ]] && [[ "${@#"--help"}" = "" ]]; then
usage
fi
if [[ $# -eq 3 ]];then
echo "参数校验开始"
# wls.rsp
rspFile=$1
# oraInst.loc
locFile=$2
# fmw_12.1.3.0.0_wls.jar
jarFile=$3
# 判断文件是否存在
fileIsExist $rspFile
fileIsExist $locFile
fileIsExist $jarFile
elif [[ $# -eq 5 ]];then
# wls.rsp
rspFile=$1
# oraInst.loc
locFile=$2
# fmw_12.1.3.0.0_wls.jar
jarFile=$3
# ./home/weblogic/Oracle/Middleware12/wlserver/common/bin/wlst.sh
domainFile=$5
# basicWLSDomain.py
basicDomainFile=$4
# 判断文件是否存在
fileIsExist $rspFile
fileIsExist $locFile
fileIsExist $jarFile
fileIsExist $basicDomainFile
fileIsExist $domainFile
else
usage
fi
# 判断 java版本是否是1.7
array=(`java -version 2>&1 |awk 'NR==1{gsub(/"/,"");print $3}'| tr '_' ' ' `)
if [[ "$array" != "1.7.0" ]];then
echo "java 版本不是1.7,无法使用该脚本"
RETVAL=1
return $RETVAL
fi
echo "参数校验通过"
echo "开始安装weblogic"
java -jar $jarFile -silent -responseFile $rspFile -invPtrLoc $locFile
if [[ $? -ne 0 ]];then
echo "安装失败"
RETVAL=1
return $RETVAL
fi
if [[ -f $basicDomainFile && -f $domainFile ]];then
sh $domainFile $basicDomainFile
fi
return $RETVAL
}
main $*
修改wls.rsp文件,指定ORACLE_HOME
[ENGINE]
#DO NOT CHANGE THIS.
Response File Version=1.0.0.0.0
[GENERIC]
#he oracle home location. This can be an existing Oracle Home or a new Oracle Home
#根据实际情况,指定ORACLE_HOME
ORACLE_HOME=/home/weblogic/Oracle/Middleware12
#Set this variable value to the Installation Type selected. e.g. WebLogic Server, Coherence, Complete with Examples.
INSTALL_TYPE=WebLogic Server
#Provide the My Oracle Support Username. If you wish to ignore Oracle Configuration Manager configuration provide empty string for user name.
MYORACLESUPPORT_USERNAME=
#Provide the My Oracle Support Password
MYORACLESUPPORT_PASSWORD=<SECURE VALUE>
#Set this to true if you wish to decline the security updates. Setting this to true and providing empty string for My Oracle Support username will ignore the Oracle Configuration Manager configuration
DECLINE_SECURITY_UPDATES=true
#Set this to true if My Oracle Support Password is specified
SECURITY_UPDATES_VIA_MYORACLESUPPORT=false
#Provide the Proxy Host
PROXY_HOST=
#Provide the Proxy Port
PROXY_PORT=
#Provide the Proxy Username
PROXY_USER=
#Provide the Proxy Password
PROXY_PWD=<SECURE VALUE>
#Type String (URL format) Indicates the OCM Repeater URL which should be of the format [scheme[Http/Https]]://[repeater host]:[repeater port]
COLLECTOR_SUPPORTHUB_URL=
修改oraInst.loc文件,指定inventory_loc
#Oracle Installer Location File Location
#Fri Jan 10 18:21:24 CST 2020
inst_group=users
#根据实际情况,指定inventory_loc
inventory_loc=/home/weblogic/Oracle
静默安装
sh installWeblogic12c.sh /home/weblogic/wls.rsp /home/weblogic/oraInst.loc fmw_12.1.3.0.0_wls.jar