安装Weblogic

WebLogic是用于开发、集成、部署和管理小型分布式Web应用、网络应用和数据库应用的Java应用服务器,由日本Oracle公司出品,是一个基于JAVAEE构架的中间件,它将Java的动态功能和JavaEnterprise标准的安全性引入小型网路应用的开发、集成、部署和管理之中。

基本概念

容器:

Web容器:运行jsp/servlet等表示层逻辑组件。

EJB容器:运行javabean,enterprisejavabean等业务层逻辑组件。

Weblogic:

BEAWebLogicServer:用于开发、集成、部署和管理小型分布式Web应用、网络应用和数据库应用的Java应用服务器。

Domain:域是个逻辑概念,拿来组织管理一系列的应用服务器实例。WebLogic应用服务器启动的时侯就是以某个域来启动的,它有一个中心配置文件叫config.xml。

Cluster:群集linux静默安装weblogic,也是一个逻辑概念,拿来分组用途相同的服务器实例鸟哥的linux私房菜,一个域中可以有多个服务。Cluster实现均衡负载和容错。

AdministrationServer:管理服务器是拿来管理配置域的中心点linux关机命令,通常来说,管理服务器上是不布署应用程序的,而是拿来统一管理、配置、监控被管理服务器以及布署应用程序到被管理服务器上。一个域中有一台管理服务器。

linux静默安装weblogic_静默安装什么意思_静默安装失败怎么办

ManagedServer:被管理服务器是拿来布署运行各类应用程序的。一个域中有一台或多台被管理服务器。

NodeManager:节点管理器是一个单独运行的后台程序linux静默安装weblogic,通常运行在被管理服务器的机器上,拿来提供远程启动和停止服务器(Server)的功能。

Domain:

一个Domain可以包含一个或多个WebLogicServer实例,甚至是Server集群。一个Domain中有一个且只能有一个Server兼任管理Server的功能,其它的Server具体实现一个特定的逻辑功能。

WebLogicServer可以在多个服务器实例上承载应用程序,每位服务器实例可以在另一台计算机上运行,并指定其自己的网路地址。您还可以将服务器组合为集群,以确保您的应用程序总是处于可用状态,虽然其中一个服务器实例失败也是这么。

使用管理控制台的此部份可以创建,配置以及控制服务器和集群。

区域说明

服务器

服务器是WebLogicServer的实例,它运行在自身的Java虚拟机(JVM)上,具有自己的配置。

集群

静默安装什么意思_静默安装失败怎么办_linux静默安装weblogic

集群是一种布署,在其中同时运行着多个WebLogicServer实例(服务器),这种服务器一起工作以提升可缩放性和可靠性。对于顾客机而言,集群是一个WebLogicServer实例。组成集群的服务器既可以在同一台计算机上运行,也可以坐落不同的计算机上。

服务器模板

服务器模板是原型服务器,使管理员可以轻松为同构服务器配置共享设置。

虚拟主机

虚拟主机是WebLogicServer实例(服务器)或集群响应的一组主机名。使用虚拟主机时,可以使用DNS指定映射到服务器IP地址或集群IP地址的一个或多个主机名。还可以指定每位虚拟主机所服务的Web应用程序。

可迁移目标

可迁移目标是一次只能在集群的一个服务器上处于活动状态的目标。

Coherence集群

Coherence集群是一组Coherence节点,这种节点共享一个容许它们进行通讯的组地址。Coherence节点可以是应用程序,模块或应用程序服务器(WebLogicServer实例或独立高速缓存服务器)。Coherence集群容许应用程序在承载须要访问服务器实例和集群的应用程序的服务器实例和集群之间共享数据管理和高速缓存服务。

计算机

计算机是承载一个或多个WebLogicServer实例(服务器)的计算机的逻辑表示。WebLogicServer使用配置的计算机名来确定个别特定任务(如HTTP会话复制)要指派到的集群中最佳服务器。管理服务器使用此计算机定义和节点管理器应用程序一上去启动远程服务器。

工作管理器

工作管理器定义一组恳求类和线程约束条件,用于管理WebLogicServer执行的工作。J2EE应用程序,Web应用程序模块,EJB和RMI应用程序可以指定命名工作管理器用于管理其工作恳求。

启动类和关掉类

启动类和关掉类是您创建的Java程序,可用其在系统范围内对应用程序提供订制服务。可将这种类添加到WebLogicServer类路径中,之后将其配置为在服务器启动或关掉时加载并运行。

在weblogic中布署项目一般有三种形式:

在控制台北安装布署;将布署包放到domain域中autodeploy目录下布署;使用域中配置文件config.xml进行项目的布署。安装

WebLogicServer有三种安装方法:

图形用户界面方式(Windows)
命令行方式(Unix/Linux)
静默安装方式(Unix/Linux)

这儿采用第三种形式,即沉静形式安装weblogic。

linux静默安装weblogic_静默安装失败怎么办_静默安装什么意思

weblogic下载地址,先下载weblogic(通用版本),然后传至服务器。

# yum remove -y openjdk
# tar zxf jdk-8u191-linux-x64.tar.gz && mv jdk1.8.0_191/ /usr/local/jdk
# vim /etc/profile
JAVA_HOME=/usr/local/jdk
PATH=$PATH:$JAVA_HOME/bin:$JAVA_HOME/jre/bin
CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/jre/lib
export JAVA_HOME PATH CLASSPATH
# source !$
# java -version
# ln -s /usr/local/jdk/bin/java /usr/local/bin/java

# useradd weblogic
# passwd weblogic
# su - weblogic
$ vim ~/.bash_profile
JAVA_HOME=/usr/local/jdk
PATH=$PATH:$JAVA_HOME/bin:$JAVA_HOME/jre/bin
CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/jre/lib
export JAVA_HOME PATH CLASSPATH
$ source !$
$ java -version

$ 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=/home/weblogic/oracle               #指定weblogic安装目录,自动创建
#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=

$ vim oraInst.loc               #创建Loc文件
inventory_loc=/home/weblogic/oraInventory
inst_group=weblogic

沉静安装命令格式:

java -jar wls_121200.jar -silent -responseFile  file -invPtrLoc file

# cp -r /software/wls_121200.jar /home/weblogic/
# chown -R weblogic:weblogic /home/weblogic/
# su - weblogic
$ chmod +x wls_121200.jar
$ java -jar wls_121200.jar -silent -responseFile /home/weblogic/wls.rsp -invPtrLoc /home/weblogic/oraInst.loc             #静默安装,需要绝对路径
Copying Files...
-----------20%----------40%----------60%----------80%--------100%
The installation of WebLogic Server 12.1.2.0.0 completed successfully.

日志成功复制到/home/weblogic/oraInventory/logs,复印此信息,说明weblogic安装成功。

创建domain有两种方法:通过纯命令行或参数文件执行创建。

静默安装什么意思_linux静默安装weblogic_静默安装失败怎么办

纯命令行创建:

$ export MW_HOME="/home/weblogic/oracle"
$ export WL_HOME="/home/weblogic/oracle/oracle_common"
$ cd /home/weblogic/oracle/wlserver/common/bin/
$ ./commEnv.sh
$ ./wlst.sh
wls:/offline> readTemplate('/home/weblogic/oracle/wlserver/common/templates/wls/wls.jar')                             
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')               #用户为weblogic
wls:/offline/base_domain/Security/base_domain/User/weblogic>cmo.setPassword('weblogic123')                  #密码是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/oracle/user_projects/domains/base_domain')
wls:/offline/base_domain/Security/base_domain/User/weblogic>closeTemplate()
wls:/offline>exit()

第一种参数文件创建:

$ cd /home/weblogic/oracle/wlserver/common/bin/
$ vim create_domains.py
readTemplate('/home/weblogic/oracle/wlserver/common/templates/wls/wls.jar')
cd('Servers/AdminServer')
set('ListenAddress','ip地址')
set('ListenPort', 7001)
cd('/Security/base_domain/User/weblogic')
cmo.setPassword('weblogic123')
setOption('OverwriteDomain', 'true')
setOption('ServerStartMode', 'prod')
writeDomain('/home/wls/user_projects/domains/second_domain')
closeTemplate()
exit()
$ ./wlst.sh ./create_domains.py

第二种参数文件创建:

$ vim /home/weblogic/create_domain.resp
read template from "/home/weblogic/oracle/wlserver/common/templates/wls/wls.jar";
set JavaHome "/usr/local/jdk";
set ServerStartMode "dev"; 
find Server "AdminServer" as AdminServer;
set AdminServer.ListenAddress "";
set AdminServer.ListenPort "7001";
set AdminServer.SSL.Enabled "true";
set AdminServer.SSL.ListenPort "7002";
create User "weblogic2" as u2;              #新建用户
set u2.password "weblogic123";
write domain to "/u02/bea/user_projects/domains/base_domain/";              #域名是"demo-domain"
close template;
$ cd /home/weblogic/oracle/wlserver/common/bin/
$ ./config.sh /home/weblogic/create_domain.resp

$ cd /home/weblogic/oracle/user_projects/domains/base_domain/bin/
$ ./startWebLogic.sh
$ netstat -lntp |grep java

网页访问:7001/console/login/LoginForm.jsp,出现登陆页面,输入用户密码登入

在这里插入图片描述

Tagged:
Author

这篇优质的内容由TA贡献而来

刘遄

《Linux就该这么学》书籍作者,RHCA认证架构师,教育学(计算机专业硕士)。

发表回复