Linux安装weblogic

服务器:contOS7
环境: oracle jdk-8u391
安装包: WebLogic Server 12.2.1.4
oracle地址: 总下载目录

1.安装步骤

1.1新增用户,添加文件夹

安装weblogic不能用ROOT用户安装,必须先新增用户

1
2
3
4
5
6
7
8
adduser weblogic
passwd weblogic
#切换用户操作
su weblogic
cd ~
#新增文件夹,存放weblogic
mkdir weblogic12c

1.2.创建oraInst.loc文件

注意指定inventory_loc路径

1
vi oraInst.loc 
1
2
inventory_loc=/home/weblogic/oraInventory
inst_group=weblgoic

清单目录中存放的文件名为orainst.loc。如果该文件不存在于您的系统上,则必须在启动静默安装之前创建该文件。安装程序使用此文件。

1.3.创建响应文件wls.rsp

注意指定ORACLE_HOME路径

1
vi wls.rsp 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
[ENGINE]
#DO NOT CHANGE THIS.
Response File Version=1.0.0.0.0
[GENERIC]
#weblogic路径 唯一需要改动的地址
ORACLE_HOME=/home/weblogic/weblogic12c/bea
#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=

1.4. 安装

注意指定wls.rsp和oraInst.loc路径

1
java -jar fmw_12.2.1.4.0_wls.jar -silent -responseFile/home/weblogic/weblogic12c/wls.rsp -invPtrLoc //home/weblogic/weblogic12c/oraInst.loc  

2.创建域

2.1配置环境变量

1
2
3
vi ~/.bash_profile
export MW_HOME=/home/weblogic/weblogic12c/bea
source ~/.bash_profile

2.2创建操作

1
2
3
#启动创建流程
cd $MW_HOME/wlserver/common/bin
./wlst.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
wls:/offline> 
#根据实际路径修改
wls:/offline> readTemplate('/home/weblogic/weblogic12c/bea/wlserver/common/templates/wls/wls.jar')
wls:/offline/base_domain> cd('Servers/AdminServer')
wls:/offline/base_domain/Server/AdminServer> set('ListenAddress','')
#配置启动端口可能执行失败,继续向下执行,默认端口为7001
wls:/offline/base_domain/Server/AdminServer> set('ListenPort', 7001)
wls:/offline/base_domain/Server/AdminServer> cd('/')
wls:/offline/base_domain> cd('Security/base_domain/User/weblogic')
#设置启动密码8位以上,包括数字或特殊字符
wls:/offline/base_domain/Security/base_domain/User/weblogic> cmo.setPassword('weblogic123')
wls:/offline/base_domain/Security/base_domain/User/weblogic> setOption('OverwriteDomain', 'true')
#设置域的路径
wls:/offline/base_domain/Security/base_domain/User/weblogic> writeDomain('/home/weblogic/weblogic12c/user_projects/armDomain')
wls:/offline/domain/Security/domain/User/weblogic>closeTemplate()
wls:/offline>exit()

3.启动weblogic

1
2
3
4
5
6
7
8
##进入创建的域目录bin下
cd /home/weblogic/weblogic12c/user_projects/armDomain
#启动
./startWebLogic.sh
#后台启动使用
nohup ./startWebLogic.sh &
#关闭weblogic
./stopWeblogic.sh

4.访问

1
http://IP:7100/console

5.安装后问题

部署应用保错 'java.lang.OutOfMemoryError: GC overhead limit exceeded'

解决方案:调大Weblogic的启动内存即可

1
2
3
4
5
6
7
8
9
10
11
12
#window:
#修改Middleware\Oracle_Home\user_projects\domains\base_domain\startWebLogic.cmd
#在SETLOCAL-ENDLOCAL中新增
set MEM_ARGS=-Xms512m -Xmx768m

#linux
#修改start-WebLogic.sh
MEM_ARGS=-Xms512m -Xmx768m
#修改bin文件夹下的setDomainEnv.sh
vim setDomainEnv.sh
WLS_MEM_ARGS_64BIT="-Xms512m -Xmx1024m"
WLS_MEM_ARGS_32BIT="-Xms512m -Xmx1024m"

6配置启动脚本

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#脚本放到weblogic文件夹下
cd /home/weblogic
#新建日志文件夹
mkdir weblogic-log

vim start-weblogic.sh
#编辑
#!/bin/bash
echo "weblogic starting..."
`nohup /home/weblogic/weblogic12c/user_projects/armDomain/startWebLogic.sh > /home/weblogic/weblogic-log/run.log 2>&1 &`

#设置权限
chmod 777 start-weblogic.sh
#启动
./start-weblogic.sh