一、安装软件环境
1.1. 下载安装包
1.2. 确认主机名在”/etc/hosts”
设置主机名
hostname dbserver120
这里是dbserver120
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.0.120 dbserver120.localdomain dbserver120
1.3. 创建组和用户
groupadd -g 1000 weblogic
useradd -u 1000 -g weblogic wlgylis
passwd wlgylis
1.4. 创建目录
root用户执行
mkdir -p /wls/bea/Oracle/Middleware/
mkdir –p /wls/webapps
mkdir /wls/software/
chown -R wlgylis:weblogic /wls/
chmod -R 775 /wls/
将所需要的软件都上传到/wls/software/目录下
1.5. 安装jdk
使用root用户执行
mkdir /usr/java
tar -xvf /wls/software/jdk-8u202-linux-x64.tar.gz -C /usr/java
ln -s /usr/java/jdk1.8.0_202 /usr/java/default
1.6. 设置环境变量
使用wlgylis用户编辑文件”~/.bash_profile”,在最后追加:
###For WebLogic
export MW_HOME=/wls/bea/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
二、安装weblogic软件
2. 1创建响应文件“/wls/software/wls.rsp”
cd /wls/software
touch wls.rsp
vim wls.rsp
wls.rsp的配置如下:
[ENGINE]
Response File Version=1.0.0.0.0
[GENERIC]
ORACLE_HOME=/wls/bea/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=
2.2创建文件”/wls/software/oraInst.loc”
touch oraInst.loc
vim oraInst.loc
oraInst.loc的配置如下:
inventory_loc=/wls/bea/oraInventory
inst_group=weblogic
2.3静默安装
使用wlgylis用户执行
unzip /wls/software/fmw_12.2.1.3.0_wls_Disk1_1of1.zip
java -Xmx1024m -jar /wls/software/fmw_12.2.1.3.0_wls.jar -silent -responseFile /wls/software/wls.rsp -invPtrLoc /wls/software/oraInst.loc
2.4查看weblogic的版本
. $WLS_HOME/server/bin/setWLSEnv.sh
java weblogic.version
2.5 给WebLogic打补丁
在MOS上找到最新的补丁,然后上传到”/wls/software”目录下,例如:p6880880_132000_Generic.zip
cd /wls/software
unzip p6880880_132000_Generic.zip
export PATH=/wls/software/OPatch:$PATH
export PATH=$MW_HOME/OPatch:$PATH
unzip -d PATCH_TOP p22331568_122100_Generic.zip
cd PATCH_TOP/22331568
export ORACLE_HOME=$MW_HOME
opatch apply -silent
再次查看WebLogic的版本,版本有可能有发生改变。
三、创建域
3.1 使用WLST创建域
3.1.1 创建文件’/wls/software/ 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()
3.1.2创建数据配置文件domain7001.properties
# Paths
path.middleware=/wls/bea/Oracle/Middleware
path.wls=/wls/bea/Oracle/Middleware/wlserver
path.domain.config=/wls/bea/Oracle/Middleware/domains
# Credentials
domain.name=demo
domain.username=weblogic
domain.password=weblogic1
# Listening address
domain.admin.port=7001
domain.admin.address=dbserver120.localdomain
domain.admin.port.ssl=7501
设置环境变量
. $WLS_HOME/server/bin/setWLSEnv.sh
3.1.3开始创建域
java weblogic.WLST create_domain.py -p /wls/software/domain7001.properties
3.1.4设置免密启动
mkdir /wls/bea/Oracle/Middleware/domains/demo/servers/AdminServer/security
在security目录下创建并编辑’boot.properties’
username=weblogic
password=weblogic
3.1.5启动weblogic服务
/wls/bea/Oracle/Middleware/domains/demo/startWebLogic.sh
启动成功后访问:http://dbserver120:7001/console
3.2配置SSL
建立keystore
mkdir /wls/keystore
cd /wls/keystore
生成密钥
# 注意CN的值一定要和访问的域名一致
$JAVA_HOME/jre/bin/keytool -genkey -keyalg RSA -alias selfsigned -keystore identity.jks -dname "CN=dbserver120.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 123456 -keystore identity.jks -storepass sinosoftforcpic -storetype jks -validity 3600
$JAVA_HOME/jre/bin/keytool -export -v -alias selfsigned -file "`hostname`-rootCA.der" -keystore identity.jks -storepass sinosoftforcpic
# Trust? yes
$JAVA_HOME/jre/bin/keytool -import -v -trustcacerts -alias selfsigned -file "`hostname`-rootCA.der" -keystore trust.jks -storepass sinosoftforcpic -noprompt
进入控制台,配置秘钥库