Loading

WebLogic 12c静默安装

安装前准备

下载软件

确认主机名能正确解析

这里使用hosts做本地解析,编辑文件'/etc/hosts'

创建组和用户

root用户执行

groupadd oinstall
useradd -g oinstall weblogic
passwd weblogic

创建目录,并设定权限

root用户执行

mkdir -p /wls/oracle/middleware
mkdir /wls/softwares/
chown -R weblogic:oinstall /wls
chmod -R 775 /wls

安装JDK

root用户执行

mkdir /usr/java
tar -xf /wls/softwares/jdk-8u201-linux-x64.tar.gz -C /usr/java/
ln -s /usr/java/jdk1.8.0_181  /usr/java/default

修改urandom参数,以加速weblogic服务的启动
原因:
It is potentially block the WebLogic SIP Server process because on some operating systems /dev/random waits for a certain amount of "noise" to be generated on the host machine before returning a result.

vim /usr/java/jdk1.8.0_201/jre/lib/security/java.security

将securerandom.source=file:/dev/urandom修改成
securerandom.source=file:/dev/./urandom

设置环境变量

使用weblogic用户编辑文件'~/.bash_profile'

###For WebLogic
export MW_HOME=/wls/oracle/middleware
export WLS_HOME=$MW_HOME/wlserver
export WL_HOME=$WLS_HOME
export JAVA_HOME=/usr/java/default
export PATH=$JAVA_HOME/bin:$PATH
##END

让环境变量生效
source ~/.bash_profile

检查是否设置成功

开通防火墙

[root@wlssrv43 ~]# firewall-cmd --add-port=7001/tcp --permanent
success
[root@wlssrv43 ~]# firewall-cmd --add-port=7501/tcp --permanent
success
[root@wlssrv43 ~]# firewall-cmd --reload
success

安装weblogic软件

创建响应文件

参考https://docs.oracle.com/middleware/1212/core/OUIRF/response_file.htm#OUIRF394

编辑文件'/wls/softwares/wls.rsp'

[ENGINE]
Response File Version=1.0.0.0.0
[GENERIC]
ORACLE_HOME=/wls//oracle/middleware
INSTALL_TYPE=WebLogic Server
MYORACLESUPPORT_USERNAME=
MYORACLESUPPORT_PASSWORD=<SECURE VALUE>
DECLINE_SECURITY_UPDATES=true
SECURITY_UPDATES_VIA_MYORACLESUPPORT=false
PROXY_HOST=
PROXY_PORT=
PROXY_USER=
PROXY_PWD=<SECURE VALUE>
COLLECTOR_SUPPORTHUB_URL=

指定Oracle的库存位置

编辑文件‘/wls/softwares/oraInst.loc’

inventory_loc=/wls/oraInventory
inst_group=oinstall

安装weblogic

java -Xmx1024m -jar /wls/softwares/fmw_12.2.1.3.0_wls.jar -silent -responseFile /wls/softwares/wls.rsp -invPtrLoc /wls/softwares/oraInst.loc

查看版本,确定安装成功

. $WLS_HOME/server/bin/setWLSEnv.sh
java weblogic.version

如图:

创建域

参考: https://docs.oracle.com/en/middleware/fusion-middleware/12.2.1.4/wlstg/domains.html#GUID-5FC3AA22-BCB0-4F98-801A-8EBC5E05DC6A

创建建域python脚本文件

create_domain.py

#!/usr/bin/python
# Author : Tim Hall
# Save Script as : create_domain.py

import time
import getopt
import sys
import re

# Get location of the properties file.
properties = ''
try:
   opts, args = getopt.getopt(sys.argv[1:],"p:h::",["properies="])
except getopt.GetoptError:
   print 'create_domain.py -p <path-to-properties-file>'
   sys.exit(2)
for opt, arg in opts:
   if opt == '-h':
      print 'create_domain.py -p <path-to-properties-file>'
      sys.exit()
   elif opt in ("-p", "--properties"):
      properties = arg
print 'properties=', properties

# Load the properties from the properties file.
from java.io import FileInputStream
 
propInputStream = FileInputStream(properties)
configProps = Properties()
configProps.load(propInputStream)

# Set all variables from values in properties file.
wlsPath=configProps.get("path.wls")
domainConfigPath=configProps.get("path.domain.config")
appConfigPath=configProps.get("path.app.config")
domainName=configProps.get("domain.name")
username=configProps.get("domain.username")
password=configProps.get("domain.password")
adminPort=configProps.get("domain.admin.port")
adminAddress=configProps.get("domain.admin.address")
adminPortSSL=configProps.get("domain.admin.port.ssl")

# Display the variable values.
print 'wlsPath=', wlsPath
print 'domainConfigPath=', domainConfigPath
print 'appConfigPath=', appConfigPath
print 'domainName=', domainName
print 'username=', username
print 'password=', password
print 'adminPort=', adminPort
print 'adminAddress=', adminAddress
print 'adminPortSSL=', adminPortSSL

# Load the template. Versions < 12.2
readTemplate(wlsPath + '/common/templates/wls/wls.jar')

# Load the template. Versions >= 12.2
#selectTemplate('Basic WebLogic Server Domain')
#loadTemplates()

# AdminServer settings.
cd('/Security/base_domain/User/' + username)
cmo.setPassword(password)
cd('/Server/AdminServer')
cmo.setName('AdminServer')
cmo.setListenPort(int(adminPort))
cmo.setListenAddress(adminAddress)

# Enable SSL. Attach the keystore later.
create('AdminServer','SSL')
cd('SSL/AdminServer')
set('Enabled', 'True')
set('ListenPort', int(adminPortSSL))

# If the domain already exists, overwrite the domain
setOption('OverwriteDomain', 'true')

setOption('ServerStartMode','prod')
setOption('AppDir', appConfigPath + '/' + domainName)

writeDomain(domainConfigPath + '/' + domainName)
closeTemplate()
exit()

创建属性文件

# Paths
path.middleware=/wls/oracle/middleware
path.wls=/wls/oracle/middleware/wlserver
path.domain.config=/wls/oracle/middleware/domains

# Credentials
domain.name=demo
domain.username=weblogic
domain.password=weblogic1

# Listening address
domain.admin.port=7001
domain.admin.address=wlssrv43.localdomain
domain.admin.port.ssl=7501

创建域

设置环境变量

. $WLS_HOME/server/bin/setWLSEnv.sh

开始建域,创建时间很长,需要耐心等待

java weblogic.WLST create_domain.py -p /wls/softwares/domain7001.properties

设置免密启动

mkdir  /wls/oracle/middleware/domains/demo/servers/AdminServer/security

在security目录下,创建并编辑文件 ‘boot.properties’

username=weblogic
password=weblogic1

启动weblogic服务

使用weblogic执行
/wls/oracle/middleware/domains/demo/startWebLogic.sh

启动成功后,访问weblogic控制台: http://wlssrv43.localdomain:7001/console

配置SSL

建立keystore

mkdir /wls/keystore
cd /wls/keystore

# 注意CN的值一定要和访问的域名一致
$JAVA_HOME/jre/bin/keytool -genkey -keyalg RSA -alias selfsigned -keystore identity.jks \
   -dname "CN=wlssrv43.localdomain, OU=IT, O=CPIC, L=Hong Kong, ST=Hong Kong, C=CN" \
   -storepass sinosoftforcpic -validity 3600 -keysize 2048 -keypass 123456

$JAVA_HOME/jre/bin/keytool -selfcert -v -alias selfsigned -keypass sinosoftforcpic -keystore identity.jks \
   -storepass 123456 -storetype jks -validity 3600

$JAVA_HOME/jre/bin/keytool -export -v -alias selfsigned -file "`hostname`-rootCA.der" -keystore identity.jks \
   -storepass 123456

# Trust? yes
$JAVA_HOME/jre/bin/keytool -import -v -trustcacerts -alias selfsigned -file "`hostname`-rootCA.der" \
   -keystore trust.jks -storepass 123456 -noprompt

生成的文件如下:

进入控制台配置密钥库

点击更改

选则定制身份和定制信任

配置keystore的相关信息

配置SSL

点击激活更改并重启weblogic服务
启动成功后,以https协议访问weblogic控制台: https://wlssrv43.localdomain:7501/console

posted @ 2022-01-06 16:02  头痛不头痛  阅读(412)  评论(0编辑  收藏  举报