linux系统weblogic12c安装

 

Weblogic12c安装文档

环境准备:这里请自己去下载就不多做说明

版本12.1.3.0.0

1.安装包下载和环境准备

mkdir /u01        

chmod 777  /u01

2.创建用户

1)创建管理用户weblogic ,并添加密码(root)

   useradd weblogic

  password  weblogic

 2)weblogic自定义配置  (weblogic)

 ~/.bash_profile,

    umask 002

    ulimit -c unlimited     

#(不限制core文件的大小)

    cd  <domain路径 >

3.安装jdk 

1)    安装jdk1.8.0_172  (root)

   

    tar -zxvf   jdk-8u172-linux-x64.tar.gz -C /usr/java/


java  -version    //查看jdk版本

 2)配置java环境变量:(weblogic )

 vi  ~/.bash_profile

 export PATH

export JAVA_HOME=/usr/local/jdk1.8.0_172

export JRE_HOME=/usr/java/jdk1.8.0_172/jre

export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib

export PATH=$JAVA_HOME/bin:$PATH

重新加载

source .bash_profile

 

4.安装weblogic12c(weblogic)

1)创建初始化文件

 mkdir  /u01/oraInventory    

mkdir  /u01/install

mkdir /u01/weblogic


把weblogic的安装包放在 /u01/install里,解压出来的包名是fmw_12.1.3.0.0_wls.jar

 cd /u01/install

 vi  /u01/install/oraInst.loc   

 inventory_loc=/u01/oraInventory

#产品清单目录;注意不能放在    weblogic安装目录下,要保证安装目录为空

inst_group=weblogic

#用户的组名称,根据实际的修改,注意用什么用户安装weblogic这里就写什么用户名,我用的是weblogic用户安的。

2)创建响应文件(注意文件内容格式,都是定格的)

 vi /u01/install/wls.rsp

 [ENGINE]

#DO NOT CHANGE THIS

Response File Version=1.0.0.0.0

[GENERIC]

#weblogic的安装路径

ORACLE_HOME=/u01/weblogic

#Set this variable value to the Installation Type selected.e.g.     WebLogic Server, Coherence, Complete with Examples.

INSTALL_TYPE=WebLogic Server

DECLINE_SECURITY_UPDATES=true

SECURITY_UPDATES_VIA_MYORACLESUPPORT=false

 

3)安装

 java -jar fmw_12.2.1.2.0_wls.jar-silent -responseFile/ait/install/wls.rsp  -invPtrLoc /ait/install/oraInst.loc

 注意:初始化文件和响应文件一定要是全路径,(自定义的)。

 

 

5、创建domain 

1)创建domain前,在/u01/weblogic/oracle_common/common/bin/config.sh  中添加随机数加快domin的创建

 JVM_ARGS="-Djava.security.egd=file:///dev/urandom-Dpython.cachedir=/tmp/cachedir ${JVM_D64} ${UTILS_MEM_ARGS}${SECURITY_JVM_ARGS} ${CONFIG_JVM_ARGS}"

 2)采用wlst脚本来建立domain

 vi /ait/install/create_domain.py

   

readTemplate('/u01/weblogic/wlserver/common/templates/wls/wls.jar')

cd('Servers/AdminServer')

set('ListenPort',7001)

 

cd('/')

cd('Security/base_domain/User/weblogic')

#如果需要修改管理员用户名为weblogic,则需要cmo.setName('weblogic')

cmo.setName('weblogic')

#用户名

cmo.setPassword('weblogic1')

#密码

setOption('ServerStartMode','prod')

setOption('OverwriteDomain','true')

writeDomain('/ait/weblogic/user_projects/proddomain') 

#自定义的domin路径

closeTemplate()

 

exit()

 

(以上脚本也可以执行wlst.sh后,一条条执行create_domain.py里的命令)

如果创建失败有报错指向这个文件,请仔细修改文件不要出现多余的字符,可以把没用的注释行删掉

 

sh   /ait/weblogic/oracle_common/common/bin/wlst.sh    /ait/install/create_domain.py

 

注:过程可能较慢耐心等待。

 

6.打补丁(根据公司情况打什么补丁,自己环境搭建的不用打)

1)查询当前补丁

 sh /u01/weblogic/OPatch/opatch lsinventory

2)打补丁

 mkdir  /u01/weblogic/PATCH_TOP

unzip -d /ait/weblogic/PATCH_TOP p25388866_122120_Generic.zip

 cd /ait/weblogic/PATCH_TOP/25388866

sh /u01/weblogic/OPatch/opatch  apply

 

7、优化

1)修改句柄数 自己环境可以不用操作此步

 

vim    /etc/security/limits.conf(root即可)  

     wlsoper  hard          nofile  10240

     wlsoper   soft          nofile  10240

 

 2)domain相关配置

(1)添加domain随机数,指定编码方式

 vi /u01/weblogic/user_projects/proddomain/bin/setDomainEnv.sh

 JAVA_OPTIONS="${JAVA_OPTIONS} -Dfile.encoding=utf-8 -Djava.security.egd=file:///dev/urandom"

export JAVA_OPTIONS

 (2)vi /u01/weblogic/user_projects/proddomain/bin/startWebLogic.sh

 修改umask 037为umask 002

 (3)vi /u01/weblogic/user_projects/proddomain/bin/stopWebLogic.sh,加入部分参数,加速 Admin Server 停止:

 echo "shutdown('${SERVER_NAME}','Server', ignoreSessions='true',timeOut=0,force='true' )" >>"shutdown.py"

 

8、启动webligic

 sh /u01/weblogic/user_projects/proddomain/bin/startWebLogic.sh   //这是在前台运行,后边有后台运行的脚本。

启动信息

[weblogic@mcl bin]$ sh startWebLogic.sh

.

.

JAVA Memory arguments: -Xms256m -Xmx512m

.

CLASSPATH=/usr/java/jdk1.8.0_131/lib/tools.jar:/ait/weblogic/wlserver/server/lib/weblogic.jar:/ait/weblogic/wlserver/../oracle_common/modules/net.sf.antcontrib_1.1.0.0_1-0b3/lib/ant-contrib.jar:/ait/weblogic/wlserver/modules/features/oracle.wls.common.nodemanager.jar::/ait/weblogic/wlserver/common/derby/lib/derbynet.jar:/ait/weblogic/wlserver/common/derby/lib/derbyclient.jar:/ait/weblogic/wlserver/common/derby/lib/derby.jar:.:/usr/java/jdk1.8.0_131/lib/dt.jar:/usr/java/jdk1.8.0_131/lib/tools.jar:/usr/java/jdk1.8.0_131/jre/lib

.

PATH=/ait/weblogic/user_projects/proddomain/bin:/ait/weblogic/wlserver/server/bin:/ait/weblogic/wlserver/../oracle_common/modules/org.apache.ant_1.9.2/bin:/usr/java/jdk1.8.0_131/jre/bin:/usr/java/jdk1.8.0_131/bin:/usr/java/jdk1.8.0_131/bin:/usr/lib64/qt-3.3/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/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:

/usr/java/jdk1.8.0_131/bin/java -server   -Xms256m-Xmx512m  -Dweblogic.Name=AdminServer-Djava.security.policy=/ait/weblogic/wlserver/server/lib/weblogic.policy -Dweblogic.ProductionModeEnabled=true  -Djava.system.class.loader=com.oracle.classloader.weblogic.LaunchClassLoader -javaagent:/ait/weblogic/wlserver/server/lib/debugpatch-agent.jar -da-Dwls.home=/ait/weblogic/wlserver/server-Dweblogic.home=/ait/weblogic/wlserver/server    -Dfile.encoding=utf-8 -Djava.security.egd=file:///dev/urandom weblogic.Server

<Sep 1, 2017 4:03:57 PM CST> <Info> <Security><BEA-090905> <Disabling the CryptoJ JCE Provider self-integrity checkfor better startup performance. To enable this check, specify-Dweblogic.security.allowCryptoJDefaultJCEVerification=true.>

<Sep 1, 2017 4:03:57 PM CST> <Info> <Security><BEA-090906> <Changing the default Random Number Generator in RSACryptoJ from ECDRBG128 to HMACDRBG. To disable this change, specify-Dweblogic.security.allowCryptoJDefaultPRNG=true.>

<Sep 1, 2017 4:03:58 PM CST> <Info> <WebLogicServer><BEA-000377> <Starting WebLogic Server with Java HotSpot(TM) 64-BitServer VM Version 25.131-b11 from Oracle Corporation.>

<Sep 1, 2017 4:03:58 PM CST> <Info> <RCM><BEA-2165021> <"ResourceManagement" is not enabled in thisJVM. Enable "ResourceManagement" to use the WebLogic Server"Resource Consumption Management" feature. To enable"ResourceManagement", you must specify the following JVM options inthe WebLogic Server instance in which the JVM runs:-XX:+UnlockCommercialFeatures -XX:+ResourceManagement.>

<Sep 1, 2017 4:03:59 PM CST> <Info> <Management><BEA-141107> <Version: WebLogic Server 12.2.1.2.0 Mon Oct  304:35:36 PDT 2016 1827450>

<Sep 1, 2017 4:04:01 PM CST> <Info> <Security><BEA-090065> <Getting boot identity from user.>

Enter username to boot WebLogic server:填用户名即weblogic

Enter password to boot WebLogic server:密码即weblogic123

 

0.1, 172.16.107.101, 0:0:0:0:0:0:0:1.>

<Sep 1, 2017, 4:14:13,669 PM CST> <Notice> <Server><BEA-002613> <Channel "Default[2]" is now listening on127.0.0.1:7001 for protocols iiop, t3, ldap, snmp, http.>

<Sep 1, 2017, 4:14:13,672 PM CST> <Notice> <Server><BEA-002613> <Channel "Default[1]" is now listening on0:0:0:0:0:0:0:1%lo:7001 for protocols iiop, t3, ldap, snmp, http.>

<Sep 1, 2017, 4:14:13,674 PM CST> <Notice> <Server><BEA-002613> <Channel "Default" is now listening on172.16.107.101:7001 for protocols iiop, t3, ldap, snmp, http.>

<Sep 1, 2017, 4:14:13,677 PM CST> <Notice> <Server><BEA-002613> <Channel "Default[2]" is now listening on127.0.0.1:7001 for protocols iiop, t3, ldap, snmp, http.>

<Sep 1, 2017, 4:14:13,677 PM CST> <Notice> <Server><BEA-002613> <Channel "Default[1]" is now listening on0:0:0:0:0:0:0:1%lo:7001 for protocols iiop, t3, ldap, snmp, http.>

<Sep 1, 2017, 4:14:13,677 PM CST> <Notice> <Server><BEA-002613> <Channel "Default" is now listening on172.16.107.101:7001 for protocols iiop, t3, ldap, snmp, http.>

<Sep 1, 2017, 4:14:13,679 PM CST> <Notice><WebLogicServer> <BEA-000329> <Started the WebLogic ServerAdministration Server "AdminServer" for domain "proddomain"running in production mode.>

<Sep 1, 2017, 4:14:13,682 PM CST> <Notice><WebLogicServer> <BEA-000360> <The server started in RUNNINGmode.>

<Sep 1, 2017, 4:14:13,717 PM CST> <Notice><WebLogicServer> <BEA-000365> <Server state changed toRUNNING.>

出现 RUNNING启动成功,可以去网页去控制台http://ip:7001/console

 

出现报错,原因是hosts文件没有指定 
报错信息如下

 

 

Enter password to boot WebLogic server:

<Sep 1, 2017 4:09:53 PM CST> <Notice> <WebLogicServer><BEA-000365> <Server state changed to STARTING.>

<Sep 1, 2017 4:09:53 PM CST> <Info> <WorkManager> <BEA-002900><Initializing self-tuning thread pool.>

<Sep 1, 2017 4:09:53 PM CST> <Info> <WorkManager><BEA-002942> <CMM memory level becomes 0. Setting standby thread poolsize to 256.>

<Sep 1, 2017, 4:09:54,185 PM CST> <Critical><WebLogicServer> <BEA-000386> <Server subsystem failed. Reason:A MultiException has 4 exceptions.  They are:

1. java.lang.AssertionError: Could not obtain the localhost address. Themost likely cause is an error in the network configuration of this machine.

2. java.lang.IllegalStateException: Unable to perform operation: postconstruct on weblogic.rjvm.RJVMService

3. java.lang.IllegalArgumentException: While attempting to resolve thedependencies of weblogic.protocol.ProtocolRegistrationService errors were found

4. java.lang.IllegalStateException: Unable to perform operation: resolveon weblogic.protocol.ProtocolRegistrationService

 

A MultiException has 4 exceptions.  They are:

1. java.lang.AssertionError: Could not obtain the localhost address. Themost likely cause is an error in the network configuration of this machine.

2. java.lang.IllegalStateException: Unable to perform operation: postconstruct on weblogic.rjvm.RJVMService

3. java.lang.IllegalArgumentException: While attempting to resolve thedependencies of weblogic.protocol.ProtocolRegistrationService errors were found

4. java.lang.IllegalStateException: Unable to perform operation: resolveon weblogic.protocol.ProtocolRegistrationService

 

    atorg.jvnet.hk2.internal.Collector.throwIfErrors(Collector.java:89)

    at org.jvnet.hk2.internal.ClazzCreator.resolveAllDependencies(ClazzCreator.java:249)

    atorg.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:357)

    atorg.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:471)

    at org.glassfish.hk2.runlevel.internal.AsyncRunLevelContext.findOrCreate(AsyncRunLevelContext.java:232)

    Truncated. see log file for complete stacktrace

Caused By: java.lang.AssertionError: Could not obtain the localhostaddress. The most likely cause is an error in the network configuration of thismachine.

    atweblogic.utils.net.AddressUtils$AddressMaker.getLocalHost(AddressUtils.java:36)

    atweblogic.utils.net.AddressUtils$AddressMaker.<clinit>(AddressUtils.java:31)

    at weblogic.utils.net.AddressUtils.getIPForLocalHost(AddressUtils.java:163)

    at weblogic.rjvm.JVMID.setLocalID(JVMID.java:277)

    at weblogic.rjvm.RJVMService.setJVMID(RJVMService.java:72)

    Truncated. see log file for complete stacktrace

Caused By: java.net.UnknownHostException: mcl: mcl: Name or service notknown

    at java.net.InetAddress.getLocalHost(InetAddress.java:1505)

    atweblogic.utils.net.AddressUtils$AddressMaker.getLocalHost(AddressUtils.java:34)

    atweblogic.utils.net.AddressUtils$AddressMaker.<clinit>(AddressUtils.java:31)

    atweblogic.utils.net.AddressUtils.getIPForLocalHost(AddressUtils.java:163)

    at weblogic.rjvm.JVMID.setLocalID(JVMID.java:277)

    Truncated. see log file for complete stacktrace

Caused By: java.net.UnknownHostException: mcl: Name or service not known

    at java.net.Inet6AddressImpl.lookupAllHostAddr(NativeMethod)

    atjava.net.InetAddress$2.lookupAllHostAddr(InetAddress.java:928)

    atjava.net.InetAddress.getAddressesFromNameService(InetAddress.java:1323)

    at java.net.InetAddress.getLocalHost(InetAddress.java:1500)

    atweblogic.utils.net.AddressUtils$AddressMaker.getLocalHost(AddressUtils.java:34)

    Truncated. see log file for complete stacktrace

***************************************************************************

The WebLogic Server encountered a critical failure

Reason: Assertion violated

***************************************************************************

Stopping Derby server...

Derby server stopped.

 

 

 

解决办法

 

[root@mcl install]# vi /etc/hosts

127.0.0.1   localhost localhost.localdomain localhost4localhost4.localdomain4

::1         localhost localhost.localdomainlocalhost6 localhost6.localdomain6

172.16.107.101  localhost localhost.localdomain  mcl                                                                                                                                                                                                    

 

9、自启脚本

  1).Adminserver启动时就不需要输入密码

mkdir /u01/weblogic/user_projects/proddomain/servers/AdminServer/security

vi /ait/weblogic/user_projects/proddomain/servers/AdminServer/security/boot.properties

    username=weblogic

    password=weblogic123

 

2)Adminserver启动脚本     //注意所有启动停止脚本要放在  /u01/weblogic/user_projects/proddomain下

 

mkdir /u01/weblogic/user_projects/proddomain/logs

 

cd /u01/weblogic/user_projects/proddomain/

 

vi /u01/weblogic/user_projects/proddomain/strAdminServer.sh

脚本内容

 

cd ./bin

mv ../logs/AdminServer.out ../logs/AdminServer`date +%Y-%m-%d-%H:%M:%S`.out
mv ../logs/AdminServer.err ../logs/AdminServer`date +%Y-%m-%d-%H:%M:%S`.err
mv ../logs/AdminServer_gc.out ../logs/AdminServer_gc`date +%Y-%m-%d-%H:%M:%S`.out

export USER_MEM_ARGS="-Xms2048m -Xmx2048m -Xmn768m  -XX:+UseConcMarkSweepGC -XX:+HeapDumpOnOutOfMemoryError -verbose:gc -Xloggc:./logs/AdminServer_gc.out -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -Dweblogic.threadpool.MinPoolSize=100 -Dweblogic.threadpool.MaxPoolSize=300 -Dweblogic.management.disableManagedServerNotifications=true"

nohup ./startWebLogic.sh 1> ../logs/AdminServer.out 2> ../logs/AdminServer.err &

tail -f ../logs/AdminServer.out

 

3)Adminserver停止脚本

vi /u01/weblogic/user_projects/proddomain/stpAdminServer.sh

 

cd ./bin

./stopWebLogic.sh

 

 

4)server 启动脚本

vi /u01/weblogic/user_projects/proddomain/startappserver1.sh

 

cd ./bin
mv ../logs/appserver1.out ../logs/appserver1`date +%Y-%m-%d-%H:%M:%S`.out
mv ../logs/appserver1.err ../logs/appserver1`date +%Y-%m-%d-%H:%M:%S`.err
mv ../logs/appserver1_gc.out ../logs/appserver1_gc`date +%Y-%m-%d-%H:%M:%S`.out

export USER_MEM_ARGS="-Xms2048m -Xmx2048m -Xmn768m  -XX:+UseConcMarkSweepGC -XX:+HeapDumpOnOutOfMemoryError -verbose:gc -Xloggc:./logs/appserver1_gc.out -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -Dweblogic.threadpool.MinPoolSize=100 -Dweblogic.threadpool.MaxPoolSize=300"

nohup ./startManagedWebLogic.sh shappserver1 t3://172.16.107.101:7001 1> ../logs/appserver1.out 2> ../logs/appserver1.err &

#tail -f ../logs/appserver1.out

注:启动脚本里的 appserver1要和后边控制台添加的服务器名一致

5)serverde 停止脚本

vi /ait/weblogic/user_projects/proddomain/stopappserver1.sh

 

cd ./bin

./stopManagedWebLogic.sh appserver1 t3://172.16.107.101:7001

10、在控制访问

1).在浏览器输入http://ip:7001/console 登陆控制台

 

 

上一篇:Windows Weblogic修改JVM内存


下一篇:Weblogic任意文件上传漏洞(CVE-2018-2894)