一、weblogic的概述
WebLogic是美国Oracle公司出品的一个application server确切的说是一个基于JAVAEE架构的中间件,BEA WebLogic是用于开发、集成、部署和管理大型分布式Web应用、网络应用和数据库应用的Java应用服务器。
多余的介绍不说,下面直接开始干货。
二、windows环境搭建
说明:weblogic的安装运行都是基于JDK来的,所以服务器上必须有JDK,我的版本是JDK1.8,JDK安装可以参考我之前的文章。
1、下载Weblogic:http://www.oracle.com/technetwork/middleware/weblogic/downloads/wls-for-dev-1703574.html。
2、也可以选择上面的通用版下载,下载到本地。我这里下的版本是12.2.1.4
的。
下载地址:https://download.oracle.com/otn/nt/middleware/12c/122140/fmw_12.2.1.4.0_wls_lite_Disk1_1of1.zip
解压出来就是一个jar
,这里说明一下,新版本的无论是windows系统,还是linux系统,都是用的这个jar
来安装的。
3、以管理员身份,定位到jar的位置,运行下面命令。
java -jar fmw_12.2.1.4.0_wls_lite_generic.jar
以上截图只是举例说明,版本不一致。
4、配置环境变量MW_HOME
D:\SERVER\Weblogic\general-package\fmw_12.2.1.4.0_wls_lite_generic
5、创建domain
在该路径下
D:\SERVER\Weblogic\general-package\fmw_12.2.1.4.0_wls_lite_generic\oracle_common\common\bin
找到config.cmd
, 点击。
勾选配置完自动启动
6、启动
D:\SERVER\Weblogic\general-package\fmw_12.2.1.4.0_wls_lite_generic\user_projects\domains\base_domain
下点击运行startWebLogic.cmd
出现Server state changed to RUNNING 字样,说明启动成功。
7、访问:http://localhost:7001/console
输入账号密码,进入
到此,windows下的weblogic的服务搭建完成。
三、linux环境搭建
基于ubuntu 18.04,这里采用静默安装的方法。
1、下载地址同windows一样:
https://download.oracle.com/otn/nt/middleware/12c/122140/fmw_12.2.1.4.0_wls_lite_Disk1_1of1.zip
2、创建weblogic的用户(按照提示操作)
sudo su
adduser weblogic
3、创建文件夹
cd /home/weblogic
mkdir install
4、上传jar
5、创建文件 /etc/oraInst.loc
cd /etc
touch oraInst.loc
vim oraInst.loc
写入下面的sh脚本
# Oracle Installer Location File Location
inst_group=weblogic #(组名称)
inventory_loc=/opt/weblogic/oraInventory #(产品清单目录,这个是安装路径)
6、创建文件 /home/weblogic/wls.rsp
cd /home/weblogic/
touch wls.rsp
vim 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=/opt/weblogic/Oracle/Middleware
#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=
保存后退出,覆权限
chmod 777 wls.rsp
7、静默安装
java -jar fmw_12.2.1.4.0_wls_lite_generic.jar -silent -responseFile /home/weblogic/install/wls.rsp -invPtrLoc /etc/oraInst.loc
8、查看是否安装好了
cd /opt/weblogic/Oracle/Middleware
9、添加weblogic环境变量
通过root用户/etc/profile添加或者weblogic用户~./bashrc
添加,添加到最末行
[weblogic@localhost ~]$ vim ~/.bashrc
export MW_HOME="/opt/weblogic/Oracle/Middleware"
export WL_HOME="/opt/weblogic/Oracle/Middleware/oracle_common"
[weblogic@localhost ~]$ source ~/.bashrc
[weblogic@localhost bin]$ cd /opt/weblogic/Oracle/Middleware/oracle_common/common/bin
[weblogic@localhost bin]$ ./commEnv.sh
10、创建域domain
mkdir -p /opt/weblogic/Oracle/Middleware/user_projects/domains/base_domain/
通过命令交互创建
[weblogic@localhost ~]$ cd /opt/weblogic/Oracle/Middleware/wlserver/common/bin
[weblogic@localhost bin]$ ./wlst.sh
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> readTemplate('/opt/weblogic/Oracle/Middleware/wlserver/common/templates/wls/wls.jar')
警告: readTemplate 已过时。在 selectTemplate 后请使用 loadTemplates 以取代 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('/opt/weblogic/Oracle/Middleware/user_projects/domains/base_domain')
wls:/offline/base_domain/Security/base_domain/User/weblogic>closeTemplate()
wls:/offline>exit()
Exiting WebLogic Scripting Tool.
[weblogic@localhost bin]$
11、启动weblogic
cd /opt/weblogic/Oracle/Middleware/user_projects/domains/base_domain/bin/
#后台启动,将stderr从定向到stdout,并将启动日志输出到/home/weblogic/weblogic.log
[weblogic@localhost bin]$ nohup ./startWebLogic.sh 2>&1 >/home/weblogic/weblogic.log &
#验证
http://ip:7001/console