linux安装weblogic(命令行)

一、安装weblogic之前要配置好java环境
环境: jdk-8u11-linux-x64.tar.gz,fmw_12.2.1.3.0_wls.jar

1、将jdk放入了 /usr/local/safe 文件夹 ,将weblogic安装包放到 /home/weblogic/install里面。

2、 进入jdk安装包的文件夹,并解压

cd  /usr/local/safe  
tar -xzf jdk-8u191-linux-x64.tar.gz 
mv jdk-8u191-linux-x64  jdk1.8  #重命名文件夹方便以后配置变量

3、配置环境变量

 cd /etc/profile
   修改profile,在文件末尾加上
export JAVA_HOME=/usr/local/jdk1.8
export JRE_HOME=/usr/local/jdk1.8/jre
export PATH=$PATH:/usr/local/jdk1.8/bin
export CLASSPATH=./:/usr/local/jdk1.8/lib:/usr/local/jdk1.8/jre/lib

4、 使修改立即生效

 source /etc/profile

5、验证是否生效

java -version

出现以下信息为安装成功

java version "1.8.0_11"
Java(TM) SE Runtime Environment (build 1.8.0_191-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.191-b12, mixed mode)

二、安装weblogic

1、创建用户组和用户,root用户无法安装 weblogic
#weblogic是组名

  groupadd weblogic              

#添加用户并指向组weblogic以及路径

useradd -g weblogic -m -d /home/weblogic weblogic 

#设置密码

  passwd weblogic

成功之后的显示界面:
Changing password for user weblogic.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.

2、 创建准备文件

1). wls.rsp

vi  /etc/wls.rsp
[ENGINE]
#DO NOT CHANGE THIS.
Response File Version=1.0.0.0.0
[GENERIC]
#The oracle home location. This can be an existing Oracle Home or a new Oracle Home
ORACLE_HOME=/home/weblogic/weblogicServer   #此处就是要修改的地方,自定义文件夹
#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=

2). vi /etc/oraInst.loc文件

 vi /etc/oraInst.loc
inventory_loc=/oracle/oraInventory    #自定义的路径,是产品清单目录
inst_group=weblogic                   #刚刚自己创建的自定义用户

3).设置文件读写权限

[root@localhost /]# cd wls
[root@localhost]# chmod 777 weblogic12/
[root@localhost]# chmod 777 wls.rsp 
[root@localhost]# chmod 777 oraInst.loc 
[root@localhost]# chmod 777 fmw_12.2.1.3.0_wls.jar

4).登录新建的用户weblogic,开始安装

su - weblogic
cd /wls
java -jar fmw_12.2.1.3.0_wls.jar  -silent  -responseFile  /etc/wls.rsp  -invPtrLoc /etc/oraInst.loc 

出现最后completed successfully,为成功安装

Launcher log file is /tmp/OraInstall2019-01-16_04-12-49PM/launcher2019-01-16_04-12-49PM.log.
Extracting the installer . . . . . . . . . . . . . . . . . . . . . Done
Checking if CPU speed is above 300 MHz.   Actual 2593.992 MHz    Passed
Checking swap space: must be greater than 512 MB.   Actual 7999 MB    Passed
Checking if this platform requires a 64-bit JVM.   Actual 64    Passed (64-bit not required)
Checking temp space: must be greater than 300 MB.   Actual 22193 MB    Passed
Preparing to launch the Oracle Universal Installer from /tmp/OraInstall2019-01-16_04-12-49PM
Log: /tmp/OraInstall2019-01-16_04-12-49PM/install2019-01-16_04-12-49PM.log
Copyright (c) 1996, 2017, Oracle and/or its affiliates. All rights reserved.
Reading response file..
Skipping Software Updates
Starting check : CertifiedVersions
Expected result: One of oracle-6, oracle-7, redhat-7, redhat-6, SuSE-11, SuSE-12
Actual Result: redhat-7.0.1406
Check complete. The overall result of this check is: Passed
CertifiedVersions Check: Success.


Starting check : CheckJDKVersion
Expected result: 1.8.0_131
Actual Result: 1.8.0_191
Check complete. The overall result of this check is: Passed
CheckJDKVersion Check: Success.


Validations are enabled for this session.
Verifying data
Copying Files
Percent Complete : 10
Percent Complete : 20
Percent Complete : 30
Percent Complete : 40
Percent Complete : 50
Percent Complete : 60
Percent Complete : 70
Percent Complete : 80
Percent Complete : 90
Percent Complete : 100

The installation of Oracle Fusion Middleware 12c WebLogic Server and Coherence 12.2.1.3.0 completed successfully.
Logs successfully copied to /wls/weblogic12/oraInventory/logs.

5).切换到root用户,创建域

su - root
Password: 
cd  /
export MW_HOME="/home/weblogic/"
export WL_HOME="/home/weblogic/oracle_common"
cd /home/weblogic/wlserver/common/bin/

开始创建

 ./wlst.sh 

这里会等一段时间,直到出现 wls:/offline>

WARNING: This is a deprecated script. Please invoke the wlst.sh script under oracle_common/common/bin.

Initializing WebLogic Scripting Tool (WLST) ...

Jython scans all the jar files it can find at first startup. Depending on the system, this process may take a few minutes to complete, and WLST may not return a prompt right away.

Welcome to WebLogic Server Administration Scripting Shell

Type help() for help on available commands

wls:/offline>

配置域

wls:/offline>后的内容为配置内容。
第一行readTemplate后会需要等一段时间。配置的各个属性都可以修改
ListenPort, 7001//端口号
cmo.setPassword(‘weblogic123’)//控制台密码
base_domain//文件夹名称

readTemplate('/home/weblogic/wlserver/common/templates/wls/wls.jar')
WARNING: The readTemplate is deprecated. Use selectTemplate followed by loadTemplates in place of readTemplate.
wls:/offline/base_domain>cd('Servers/AdminServer')
wls:/offline/base_domain/Server/AdminServer>set('ListenAddress','')
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')
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/user_projects/domains/base_domain')  
wls:/offline/base_domain/Security/base_domain/User/weblogic>closeTemplate()
wls:/offline>exit()    #退出配置

Exiting WebLogic Scripting Tool.

启动weblogic
进入base_domain文件夹,用nohup 后台运行

cd   /home/weblogic/user_projects/domains/base_domain/
nohup ./startWebLogic.sh &

运行成功如下:

[1] 15356
[root@iZ88w5 base_domain]# nohup: ignoring input and appending output to 鈥榥ohup.out鈥?

此时,base_domain文件夹下,会生成nohup.out文件,此为日志文件

登录控制台
登录http://xx.xx.xx.xx:7001/console/***
用户名为
weblogic
*,密码为weblogic123(或自己设置的值,不要太简单,一定要记住,最好英文加数字,否则可能会创建失败)。
启动后大概需要等1到2分钟。如果2分钟后仍然进不了控制台,可以查看日志,是否有报错。

部署项目
部署一般用以下两种方式:
1.打包成war
2.直接找到项目下的webapp文件夹,上传linux后,在控制台部署

一直下一步,部署好了,项目为正常,就可以访问了。

猜你喜欢

转载自blog.csdn.net/qq_34362409/article/details/103623813
今日推荐