本文最后更新于2022年6月1日,已超过 1 年没更新!内容可能已失效,请自行测试。

CentOS7.3版本

配置1C2G

准备工作

安装JDK1.8

创建目录存放jdk并进入目录

mkdir /usr/java
cd /usr/java/

下载JDK1.8jar包

wget  https://download.oracle.com/otn/java/jdk/8u261-b12/a4634525489241b9a9e1aa73d9e118e6/jdk-8u261-linux-x64.tar.gz?AuthParam=1598499735_3a533edfe4261c6616207b80d092d181

地址失效可官网自行下载然后上传至服务器目录

解压压缩包

tar -xvzf jdk-8u261-linux-x64.tar.gz\?AuthParam\=1598499735_3a533edfe4261c6616207b80d092d181

编辑环境变量

vim /etc/profile

添加几个配置项

export JAVA_HOME=/usr/java/jdk1.8.0_261
export CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH
export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH

使配置文件生效

source /etc/profile

输入java -version测试是否成功

下载Weblogic安装包

前往官网下载12.1.3版本,选择Generic通用安装包,下载完毕后上传至/usr/java目录

点击下载

解压压缩包得到Weblogic的jar包

创建用户

Generic通用版本的安装不能使用root用户进行安装,所以需要新建一个用户

useradd weblogic

为weblogic设置密码

passwd weblogic

配置主机名和IP的映射

vi /etc/hosts

添加配置项192.168.1.200 yeyufan

创建必要的目录

创建/usr/local/products/oraInventory目录并给weblogic用户赋权

mkdir -p /usr/local/products/oraInventory
chown weblogic:weblogic /usr/local/products/oraInventory

创建weblogic安装目录

cd /
mkdir weblogic
chown weblogic:weblogic /weblogic

创建oraInst.loc文件

在家目录下创建oraInst.loc文件

cd /usr/java
vim oraInst.loc
chown weblogic:weblogic oraInst.loc

添加配置项

inventory_loc=/usr/local/products/oraInventory
inst_group=yeyufan

创建wls.rsp响应文件

在家目录下创建wls.rsp响应文件

cd /usr/java
vim wls.rsp
chown weblogic:weblogic wls.rsp

插入下面的模板,只用修改ORACLE_HOME的路径,即WebLogic Server的安装路径

[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=/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=

增加swap

首先free -m查看是否有足够的swap 没有的话需要增加

root用户创建swap分区的文件

su root
dd if=/dev/zero of=swapfile bs=1M count=1024

格式化交换分区文件

mkswap swapfile

启用swap分区文件

swapon swapfile

添加开机启动:修改/etc/fstab这个文件,添加这一行

vim /etc/fstab
swapfile swap swap defaults 0 0

开始安装

切换至weblogic用户下,执行安装命令

java -jar fmw_12.2.1.3.0_wls.jar -silent -responseFile /usr/java/wls.rsp -invPtrLoc /usr/java/oraInst.loc

成功的日志如下

Launcher log file is /tmp/OraInstall2020-08-27_01-30-44PM/launcher2020-08-27_01-30-44PM.log.
Extracting the installer . . . . . . . . . . Done
Checking if CPU speed is above 300 MHz.   Actual 2494.222 MHz    Passed
Checking swap space: must be greater than 512 MB.   Actual 1023 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 32389 MB    Passed
Preparing to launch the Oracle Universal Installer from /tmp/OraInstall2020-08-27_01-30-44PM
Log: /tmp/OraInstall2020-08-27_01-30-44PM/install2020-08-27_01-30-44PM.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.3.1611
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_261
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 /usr/local/products/oraInventory/logs.

配置环境变量

编辑/etc/profile 增加一行

export MW_HOME=/weblogic

source /etc/profile 使其生效

创建Domain

创建域存放目录

cd /weblogic
mkdir domain
cd $MW_HOME/wlserver/common/bin
./wlst.sh 

--此时刷日志
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
--依次输入下面的命令
readTemplate('/weblogic/wlserver/common/templates/wls/wls.jar')
cd('Servers/AdminServer')
set('ListenAddress','')
set('ListenPort', 7001)
cd('/')
cd('Security/base_domain/User/weblogic')
cmo.setPassword('weblogic12')
setOption('OverwriteDomain', 'true')
writeDomain('/weblogic/domain')
exit()

启动Weblogic

进入创建的域目录bin下

cd /weblogic/domain/bin/

后台启动使用nohup ./startWebLogic.sh &

nohup ./startWebLogic.sh &

启动浏览器访问控制台

http://IP:7001/console

用户名默认是weblogic,密码是创建域时设置的weblogic12

第一次访问控制台会显示下面的界面,等一会或刷新进入到控制台登录界面

=

一沙一世界,一花一天堂。君掌盛无边,刹那成永恒。