1、创建domain模板
#创建域目录
mkdir /weblogic/bea12/user_projects/domains/mydomain -p
cd bea12/user_projects/domains/mydomain
#创建域模板
cat > mydomain.py << EOF
readTemplate("/weblogic/bea12/wlserver/common/templates/wls/wls.jar")
# Config AdminServer Listen Address and Port
cd('Servers/AdminServer')
#用set去重置domain管理服务的名称,这个生产中比较使用,比如一台部署多个domain的场景,方便服务查杀
set('Name','myServer')
#设置domain管理服务端口
set('ListenAddress','')
set('ListenPort', 8000)
# Config username and password of Console User
cd('/')
# 'Security/base_domain/User/weblogic' The 'weblogic' is username
cd('Security/base_domain/User/weblogic')
#domain的用户名密码,生产中密码要严肃点,这里随意了。
cmo.setName('weblogic')
cmo.setPassword('weblogic123#')
#设置生产模式
cd('/')
set('ProductionModeEnabled','true')
#设置控制台上下文名称,这个很重要,生产中如果使用默认上下文安全扫描可能通不过。
set('ConsoleContextPath','csl')
# If the domain already exists, overwrite the domain
setOption('OverwriteDomain', 'true')
# Config home directory for the JVM to be used when starting the weblogic server
setOption('JavaHome', '/opt/jdk1.8')
# Domain 目录
writeDomain('/weblogic/bea12/user_projects/domains/mydomain')
# Close Template
closeTemplate()
# Exit script
exit()
EOF
2、执行wlst创建域
[weblogic@v-app-20 domains]$ /weblogic/bea12/wlserver/common/bin/wlst.sh /weblogic/bea12/user_projects/domains/mydomain.py
WARNING: This is a deprecated script. Please invoke the wlst.sh script under oracle_common/common/bin.
Initializing WebLogic Scripting Tool (WLST) ...
Welcome to WebLogic Server Administration Scripting Shell
Type help() for help on available commands
Exiting WebLogic Scripting Tool.
3、启动管理服务
[weblogic@v-app-20 mydomain]$ ./startWebLogic.sh
.
.
JAVA Memory arguments: -Xms256m -Xmx512m -XX:CompileThreshold=8000
.
CLASSPATH=/opt/jdk1.8/lib/tools.jar:/weblogic/bea12/wlserver/server/lib/weblogic.jar:/weblogic/bea12/wlserver/../oracle_common/modules/thirdparty/ant-contrib-1.0b3.jar:/weblogic/bea12/wlserver/modules/features/oracle.wls.common.nodemanager.jar::/weblogic/bea12/wlserver/common/derby/lib/derbynet.jar:/weblogic/bea12/wlserver/common/derby/lib/derbyclient.jar:/weblogic/bea12/wlserver/common/derby/lib/derby.jar:.:/lib/dt.jar:/lib/tools.jar
.
PATH=/weblogic/bea12/user_projects/domains/mydomain/bin:/weblogic/bea12/wlserver/server/bin:/weblogic/bea12/wlserver/../oracle_common/modules/thirdparty/org.apache.ant/1.9.8.0.0/apache-ant-1.9.8/bin:/opt/jdk1.8/jre/bin:/opt/jdk1.8/bin:/opt/jdk1.8/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/weblogic/.local/bin:/weblogic/bin
.
***************************************************
* To start WebLogic Server, use a username and *
* password assigned to an admin-level user. For *
* server administration, use the WebLogic Server *
* console at http://hostname:port/console *
***************************************************
Starting WLS with line:
……