引言

WebLogic Server(WLS)是Oracle公司的一款高性能、高可用的Java应用服务器。在CentOS上部署WebLogic Server,可以通过静默安装的方式简化部署过程。本文将详细解析如何在CentOS上通过静默安装部署WebLogic Server。

准备工作

1. 系统要求

  • 操作系统:CentOS 7
  • 硬件要求:根据实际应用需求配置CPU、内存和磁盘空间
  • Java环境:JDK 1.8或更高版本

2. 安装前准备工作

  • 更新系统:
    
    sudo yum update -y
    
  • 安装必要的依赖包:
    
    sudo yum install -y unzip java-1.8.0-openjdk-headless
    

静默安装步骤

1. 准备WebLogic安装包

  • 下载WebLogic Server安装包,例如:weblogic-server-12.2.1.3.0.zip

2. 创建WebLogic用户

  • 创建WebLogic用户和用户组:
    
    sudo groupadd weblogic
    sudo useradd -g weblogic -d /home/weblogic -s /bin/bash weblogic
    

3. 解压安装包

  • 解压WebLogic安装包到指定目录:
    
    unzip weblogic-server-12.2.1.3.0.zip -d /opt/oracle
    

4. 配置环境变量

  • 编辑/home/weblogic/.bash_profile文件,添加以下内容:
    
    export ORACLE_HOME=/opt/oracle/weblogic-server-12.2.1.3.0
    export WLS_HOME=$ORACLE_HOME
    export PATH=$PATH:$ORACLE_HOME/bin
    
  • 使环境变量生效:
    
    source /home/weblogic/.bash_profile
    

5. 创建域

  • 使用wlst.sh脚本创建域:
    
    cd $ORACLE_HOME/wlst
    ./wlst.sh -skipWLSModuleScanning -loadProperties create_domain.py
    
  • create_domain.py脚本内容如下: “`python #!/usr/bin/python import os from wlstlib.wlst import *

# Define the domain directory domainDir = ‘/opt/oracle/user_projects/domains/base_domain’

# Create a domain createDomain(‘base_domain’, domainDir, ‘weblogic’, ‘welcome1’, ‘Welcome1’)

# Print the domain directory print(‘Domain directory is: ’ + domainDir)


### 6. 配置管理员密码
- 使用`setDomainEnv`命令配置管理员密码:
  ```bash
  cd $ORACLE_HOME/wlst
  ./wlst.sh -skipWLSModuleScanning -loadProperties set_admin_password.py
  • set_admin_password.py脚本内容如下: “`python #!/usr/bin/python import os from wlstlib.wlst import *

# Define the domain directory domainDir = ‘/opt/oracle/user_projects/domains/base_domain’

# Set the admin password setAdminPassword(‘Welcome1’)

# Print the domain directory print(‘Domain directory is: ’ + domainDir)


### 7. 启动域
- 使用`startDomain`命令启动域:
  ```bash
  cd $ORACLE_HOME/wlst
  ./wlst.sh -skipWLSModuleScanning -loadProperties start_domain.py
  • start_domain.py脚本内容如下: “`python #!/usr/bin/python import os from wlstlib.wlst import *

# Define the domain directory domainDir = ‘/opt/oracle/user_projects/domains/base_domain’

# Start the domain startDomain(domainDir)

# Print the domain directory print(‘Domain directory is: ’ + domainDir) “`

总结

通过以上步骤,您可以在CentOS上通过静默安装部署WebLogic Server。在实际部署过程中,您可能需要根据实际需求调整脚本内容和配置。希望本文能帮助您顺利部署WebLogic Server。