运行环境:windows下vm中centos6.5
weblogic版本:12.2.1.4.0
一、jdk
由于centos6.5默认安装的jdk版本不符合(默认安装1.7.0.91),所以需要新下载并安装jdk
命令:rpm -qa | grep openjdk
卸载系统自带jdk(有几个执行几次命令):rpm -e --nodeps [上面命令获取到jdk的名称]
安装jdk(jdk-7或者8均可):https://www.oracle.com/java/technologies/javase/javase7-archive-downloads.html
(1)新建文件夹:mkdir -p /usr/java
(2)将下载的文件上传,【使用(secureCRT)如果安装上传下载工具:yum install lrzsz】
(3)安装jdk:rpm -ivh [下载的jdk.rpm]
jdk环境配置
vi /etc/profile
#最文本最后添加:
export JAVA_HOME=/usr/java/jdk1.7.0_79
export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$PATH:$JAVA_HOME/bin
#并存并退出后,使配置生效
source /etc/profile
#查看是否安装成功:
java -version
二、weblogic
下载weblogic:https://www.oracle.com/middleware/technologies/weblogic-server-downloads.html
新建weblogic相关用户与组
# 创建weblogic组
sudo groupadd weblogic
# 创建weblogic用户并指定组
sudo useradd -mg weblogic weblogic
# 修改weblogic密码
sudo passwd weblogic
#创建weblogic目录
sudo mkdir -p /weblogic
sudo chown weblogic:weblogic /weblogic
#切换用户
su - weblogic
切换到weblogic用户下运行(root下也可以)
新建目录:/usr/weblogic
将文件上传致该目录下(如果是通过tmp过度的话,请及时删除文件,否则会出现临时文件不够错误)
安装weblogic:java -jar fmw_12.2.1.4.0_wls_quick.jar
文件安装成功
配置weblogic 应用域(使用weblogic scripting tool(WLST)脚本方式)
新建域目录:dir -p /usr/weblogic/user_projects/domains
复制basicWLSDomain.py到/usr/weblogic/user_projects/domains
修改复制过来的basicWLSDomain.py文件
#=======================================================================================
# This is an example of a simple WLST offline configuration script. The script creates
# a simple WebLogic domain using the Basic WebLogic Server Domain template. The script
# demonstrates how to open a domain template, create and edit configuration objects,
# and write the domain configuration information to the specified directory.
#
# This sample uses the demo Derby Server that is installed with your product.
# Before starting the Administration Server, you should start the demo Derby server
# by issuing one of the following commands:
#
# Windows: WL_HOME\common\derby\bin\startNetworkServer.cmd
# UNIX: WL_HOME/common/derby/bin/startNetworkServer.sh
#
# (WL_HOME refers to the top-level installation directory for WebLogic Server.)
#
# The sample consists of a single server, representing a typical development environment.
# This type of configuration is not recommended for production environments.
#
# Please note that some of the values used in this script are subject to change based on
# your WebLogic installation and the template you are using.
#
# Usage:
# java weblogic.WLST
#
# Where:
# specifies the full path to the WLST script.
#=======================================================================================
#=======================================================================================
# Open a domain template.
#=======================================================================================
readTemplate("/usr/weblogic/wls12214/wlserver/common/templates/wls/wls.jar")
#=======================================================================================
# Configure the Administration Server and SSL port.
#
# To enable access by both local and remote processes, you should not set the
# listen address for the server instance (that is, it should be left blank or not set).
# In this case, the server instance will determine the address of the machine and
# listen on it.
#=======================================================================================
cd('Servers/AdminServer')
set('ListenAddress','')
set('ListenPort', 7001)
create('AdminServer','SSL')
cd('SSL/AdminServer')
set('Enabled', 'True')
set('ListenPort', 7002)
#=======================================================================================
# Define the user password for weblogic.
#=======================================================================================
cd('/')
cd('Security/base_domain/User/weblogic')
# Please set password here before using this script, e.g. cmo.setPassword('value')
cmo.setPassword('weblogic123')
#=======================================================================================
# Create a JMS Server.
#=======================================================================================
cd('/')
create('myJMSServer', 'JMSServer')
#=======================================================================================
# Create a JMS System resource.
#=======================================================================================
cd('/')
create('myJmsSystemResource', 'JMSSystemResource')
cd('JMSSystemResource/myJmsSystemResource/JmsResource/NO_NAME_0')
#=======================================================================================
# Create a JMS Queue and its subdeployment.
#=======================================================================================
myq=create('myQueue','Queue')
myq.setJNDIName('jms/myqueue')
myq.setSubDeploymentName('myQueueSubDeployment')
cd('/')
cd('JMSSystemResource/myJmsSystemResource')
create('myQueueSubDeployment', 'SubDeployment')
#=======================================================================================
# Create and configure a JDBC Data Source, and sets the JDBC user.
#=======================================================================================
cd('/')
create('myDataSource', 'JDBCSystemResource')
cd('JDBCSystemResource/myDataSource/JdbcResource/myDataSource')
create('myJdbcDriverParams','JDBCDriverParams')
cd('JDBCDriverParams/NO_NAME_0')
set('DriverName','org.apache.derby.jdbc.ClientDriver')
set('URL','jdbc:derby://localhost:1527/db;create=true')
set('PasswordEncrypted', 'PBPUBLIC')
set('UseXADataSourceInterface', 'false')
create('myProps','Properties')
cd('Properties/NO_NAME_0')
create('user', 'Property')
cd('Property/user')
cmo.setValue('PBPUBLIC')
cd('/JDBCSystemResource/myDataSource/JdbcResource/myDataSource')
create('myJdbcDataSourceParams','JDBCDataSourceParams')
cd('JDBCDataSourceParams/NO_NAME_0')
set('JNDIName', java.lang.String("myDataSource_jndi"))
cd('/JDBCSystemResource/myDataSource/JdbcResource/myDataSource')
create('myJdbcConnectionPoolParams','JDBCConnectionPoolParams')
cd('JDBCConnectionPoolParams/NO_NAME_0')
set('TestTableName','SYSTABLES')
#=======================================================================================
# Target resources to the servers.
#=======================================================================================
cd('/')
assign('JMSServer', 'myJMSServer', 'Target', 'AdminServer')
assign('JMSSystemResource.SubDeployment', 'myJmsSystemResource.myQueueSubDeployment', 'Target', 'myJMSServer')
assign('JDBCSystemResource', 'myDataSource', 'Target', 'AdminServer')
#=======================================================================================
# Write the domain and close the domain template.
#=======================================================================================
setOption('OverwriteDomain', 'true')
writeDomain('/usr/weblogic/user_projects/domains/basicWLSDomain')
closeTemplate()
#=======================================================================================
# Exit WLST.
#=======================================================================================
exit()
执行命令:
cd /usr/weblogic/user_projects/domains
sh /usr/weblogic/wls12213/oracle_common/common/bin/wlst.sh basicWLSDomain.py
启动域:
cd basicWLSDomain
sh startWebLogic.sh
访问http://x.x.x.x:7001/console。
默认密码:weblogic/weblogic123
安装weblogic请确认jdk是否支持、安装weblogic时候使用的用户、本地虚机是否有足够的内存支持系统的安装。
具体图形化操作可以参考链接:https://blog.csdn.net/q283614346/article/details/86658055