第一步:准备需要的安装包文件,这里注意 weblogic12.2.*需要的最低JDK版本为1.8以上
1、查看当前的镜像列表:docker images
2、运行镜像,并进入容器,这里运行基本的centos-ssh 的镜像
运行镜像---运行命令:docker run -d -i -t -p 1601:22 dc8713dad282 /bin/bash
查看当前运行的容器:docker ps
运行命令:docker exec -it ef34fa2e3b39 /bin/bash 如下图 进入了容器
3、进行安装文件的包拷贝
新开启一个终端SSH 连接宿主机 如下
拷贝安装包到docker容器里面去: 宿主机如何和docker容器互相拷贝传送文件,请查询相关资料
执行命令:docker cp /toolsPackage/jdk-8u65-linux-x64.tar.gz ef34fa2e3b39:/opt
docker cp /toolsPackage/fmw_12.2.1.3.0_wls.jar ef34fa2e3b39:/opt
拷贝了JDK 和 weblogic12.2.1.3安装包进入容器
4、进入容器 ef34fa2e3b39 查看 结果 如下图
5、安装JDK文件 运行命令:tar -xvf jdk-8u65-linux-x64.tar.gz
解压安装包文件到 /opt/jdk1.8.0_65 目录下
配置JDK的环境变量 编辑 vi ~/.bashrc 文件添加如下
export USER_MEM_ARGS="-Xms2048m -Xmx2048m -XX:PermSize=512m"
export JAVA_HOME=/opt/jdk1.8.0_65
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$JAVA_HOME/bin:$PATH
如下图:
保存退出,运行命令:source ~/.bashrc 保证修改的环境变量生效
6、创建两个 静默安装weblogic的响应文件 如下:
/opt/oraInst.loc
inventory_loc=/home/weblogic/oraInventory1
#用户的组名称,根据实际的修改
inst_group=weblogic
/opt/wsl.rsp
[ENGINE]
#DO NOT CHANGE THIS.
Response File Version=1.0.0.0.0
[GENERIC]
#Set this to true if you wish to skip software updates
DECLINE_AUTO_UPDATES=true
#My Oracle Support User Name
MOS_USERNAME=
#My Oracle Support Password
MOS_PASSWORD=
#If the Software updates are already downloaded and available on your local system, then specify the path to the directory where these patches are available and set SPECIFY_DOWNLOAD_LOCATION to true
AUTO_UPDATES_LOCATION=
#Proxy Server Name to connect to My Oracle Support
SOFTWARE_UPDATES_PROXY_SERVER=
#Proxy Server Port
SOFTWARE_UPDATES_PROXY_PORT=
#Proxy Server Username
SOFTWARE_UPDATES_PROXY_USER=
#Proxy Server Password
SOFTWARE_UPDATES_PROXY_PASSWORD=
#The oracle home location. This can be an existing Oracle Home or a new Oracle Home 为weblogic的安装目录
ORACLE_HOME=/opt/weblogic/Middleware
#The federated oracle home locations. This should be an existing Oracle Home. Multiple values can be provided as comma seperated values
FEDERATED_ORACLE_HOMES=
#Set this variable value to the Installation Type selected. e.g. WebLogic Server, Coherence, Complete with Examples.
INSTALL_TYPE=WebLogic Server
7、设置用户组相关信息
添加组信息,运行命令:groupadd bea
添加用户信息,运行命令:useradd -g bea weblogic
为用户weblogic 指定密码:passwd weblogic
8、安装weblogic中间件
保证所安装的目录 weblogic具备读写权限
运行命令:chown -R weblogic:bea /opt
安装 wls.rsp,oraInst.loc必须指定绝对路径 java -jar fmw_12.1.3.0.0_wls.jar -silent -responseFile /home/weblogic/wls.rsp -invPtrLoc /home/weblogic/oraInst.loc
运行命令: java -jar fmw_12.2.1.3.0_wls.jar -silent -responseFile /opt/wsl.rsp -invPtrLoc /opt/oraInst.loc
由于没有设置weblogic用户的JDK环境变量,报错,设置weblogic的环境变量:
运行命令:vi ~/.bashrc 添加jdk的环境变量
运行命令:source ~/.bashrc
再次运行安装命令: java -jar fmw_12.2.1.3.0_wls.jar -silent -responseFile /opt/wsl.rsp -invPtrLoc /opt/oraInst.loc
[weblogic@ef34fa2e3b39 opt]$ java -jar fmw_12.2.1.3.0_wls.jar -silent -responseFile /opt/wsl.rsp -invPtrLoc /opt/oraInst.loc
Launcher log file is /tmp/OraInstall2018-08-17_02-11-36AM/launcher2018-08-17_02-11-36AM.log.
Extracting the installer . . . . . . . . . . . Done
The OpenJDK JVM is not supported on this platform.
The log is located here: /tmp/OraInstall2018-08-17_02-11-36AM/launcher2018-08-17_02-11-36AM.log.
[weblogic@ef34fa2e3b39 opt]$ vi ~/.bashrc
[weblogic@ef34fa2e3b39 opt]$ source ~/.bashrc
[weblogic@ef34fa2e3b39 opt]$ java -jar fmw_12.2.1.3.0_wls.jar -silent -responseFile /opt/wsl.rsp -invPtrLoc /opt/oraInst.loc
Launcher log file is /tmp/OraInstall2018-08-17_02-15-23AM/launcher2018-08-17_02-15-23AM.log.
Extracting the installer . . . . . . . . . . Done
Checking if CPU speed is above 300 MHz. Actual 2595.809 MHz Passed
Checking swap space: must be greater than 512 MB. Actual 2047 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 15079 MB Passed
Preparing to launch the Oracle Universal Installer from /tmp/OraInstall2018-08-17_02-15-23AM
Log: /tmp/OraInstall2018-08-17_02-15-23AM/install2018-08-17_02-15-23AM.log
Copyright (c) 1996, 2017, Oracle and/or its affiliates. All rights reserved.
Reading response file..
Skipping Software Updates
Starting check : CertifiedVersions
Prerequisite Check was skipped and did not execute.
Warning: Check:CertifiedVersions completed with warnings.
Starting check : CheckJDKVersion
Problem: This JDK version was not certified at the time it was made generally available. It may have been certified following general availability.
Recommendation: Check the Supported System Configurations Guide (http://www.oracle.com/technetwork/middleware/ias/downloads/fusion-certification-100350.html) for further details. Press "Next" if you wish to continue.
Expected result: 1.8.0_131
Actual result: 1.8.0_65
Warning: Check:CheckJDKVersion completed with warnings.
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 /home/weblogic/oraInventory1/logs.
成功安装了weblogic中间件:
9、创建weblogic 运行域
先创建存放路径,运行命令:mkdir -p /opt/weblogic/Middleware/user_projects/domains/base_domain/
创建参数文件 create_domain.rsp 如下: 在目录:/opt/create_domain.rsp
read template from "/opt/weblogic/Middleware/wlserver/common/templates/wls/wls.jar";
set JavaHome "/opt/jdk1.8.0_65";
set ServerStartMode "prod";
find Server "AdminServer" as AdminServer;
set AdminServer.ListenAddress "";
set AdminServer.ListenPort "7010";
set AdminServer.SSL.Enabled "true";
set AdminServer.SSL.ListenPort "7002";
//Create Machine
//create Machine "base" as Machinename;
//use templates default weblogic user
find User "weblogic" as u1;
set u1.password "1qaz@WSX";
write domain to "/opt/weblogic/Middleware/user_projects/domains/base_domain/";
// The domain name will be "demo-domain"
close template;
静默创建域 cd /opt/weblogic/Oracle/Middleware/wlserver/common/bin
运行命令: ./config.sh -mode=silent -silent_script=/opt/create_domain.rsp -logfile=/opt/create_domain.log
到此就已经成功的创建了域,下面启动服务,进入控制台
运行命令:./startWeblogic.sh 出现如下的界面:启动成功
10、登录控制台:http://ip:7001/console 这里实际登录地址为:http://192.168.58.129:7001/console 而weblogic实际监听的端口在容器中为7010 ,这在启动docker容器的时候 就通过参数-p 7001:7010 做了宿主机和docker容器之间的端口映射功能;
11、提交刚才安装的jdk和weblogic12.2.1.3中间件,保存为镜像
运行命令: docker ps 查看当前运行容器的 id 为 : ef34fa2e3b39
运行命令:docker commit -m "install weblogic12.2.1.3" -a "weblogic12.2.1.3" ef34fa2e3b39 weblogic12.2.1.3:latest 保存容器提交为新的镜像
运行命令:docker images 查看当前的镜像列表,可以看到刚保存的新镜像weblogic12.2.1.3