命令行方式安装IBM WebSphere Application Server

作为IBMer,经常需要在项目中安装WebSphere Application Server(下简称WAS),但是已有的中文文档很多都是基于Installation Manager(下简称IM)桌面版安装,在Linux环境下有很多不便。查阅很多资料后总结了一套完全基于命令行的安装和更新WAS的经验,这里介绍一下,希望能给不熟悉WAS的人一些帮助。

安装IM
  1. 下载

    • 打开官方下载地址,选择Linux版本的IM,这里以1.8.4为例
    • 根据Linux版本下载
    • 选择HTTPS下载,并找到安装包的下载地址(右键->复制链接地址)
    • 在Linux上用Curl或Wget下载
      $ curl -O https://delivery04.dhe.ibm.com/sdfdl/v2/sar/CM/RA/05u2m/0/Xa.2/Xb.jusyLTSp44S0wbvvZmFyjKfV3PrI9bfE8O4rfS43L6ZzJNqTCICe53wmosw/Xc.CM/RA/05u2m/0/agent.installer.linux.gtk.x86_64_1.8.4000.20151125_0201.zip/Xd./Xf.LPR.D1VC/Xg.8709125/Xi.habanero/XY.habanero/XZ._gm1_dPcRs5Ym7UR0u0XuV1dSnk/agent.installer.linux.gtk.x86_64_1.8.4000.20151125_0201.zip
  2. 解压并安装

    $ unzip agent.installer.linux.gtk.x86_64_1.8.4000.20151125_0201.zip

    默认安装路径为/opt/IBM/InstallationManager

    $ ./installc -log log_file -acceptLicense

    (installc命令的用法详见安装文档)

安装WAS
  1. 下载
    官方地址按步骤下载Linux版本的WAS。需要使用绑定了site number的IBM ID登录 IBM Passport Advantage Online website,检索Part number找到相应的文件进行下载。以WAS ND 8.5.5为例, “CIK2HML,CIK2IML,CIK2JML”对应三个文件。
  2. 解压

    • 将三个文件解压到同一个路径下,这里解压到/opt/Software/WAS85ND/

      $ ls -l /opt/Software/WAS85ND/
      total 36
      -rw-r--r-- 1 root root 380 May 14 2013 Copyright.txt
      drwxr-xr-x 3 root root 4096 May 14 2013 Remote_Installation_Tool_for_IBM_i
      drwxr-xr-x 5 root root 4096 Mar 8 22:45 disk1
      drwxr-xr-x 3 root root 4096 May 14 2013 disk2
      drwxr-xr-x 3 root root 4096 May 14 2013 disk3
      drwxr-xr-x 2 root root 4096 May 14 2013 lafiles
      drwxr-xr-x 10 root root 4096 May 14 2013 readme
      -rw-r--r-- 1 root root 81 May 14 2013 repository.config
      drwxr-xr-x 3 root root 4096 May 14 2013 responsefiles
    • 可以通过IM的listAvailablePackages命令验证安装包的版本:

      $ /opt/IBM/InstallationManager/eclipse/tools/imcl listAvailablePackages \
      -repositories /opt/Software/WAS85ND/
      com.ibm.websphere.ND.v85_8.5.5000.20130514_1044

    输出的结果中com.ibm.websphere.ND.v85是WAS的offering_ID8.5.5000.20130514_1044offering_version,在下文中更新WAS的时候会用到。

  3. 安装

    • install命令进行安装,-installationDirectory参数指定安装路径

      $ /opt/IBM/InstallationManager/eclipse/tools/imcl \
      install com.ibm.websphere.ND.v85 \
      -repositories /opt/Software/WAS85ND/ \
      -installationDirectory /opt/IBM/WebSphere/AppServer/ \
      -acceptLicense -showProgress
    • 安装成功

    • 验证

      $ /opt/IBM/InstallationManager/eclipse/tools/imcl listInstalledPackages -verbose

更新WAS(安装Fix pack)
方法一:利用IBM service repositories安装(推荐)
  1. 获取可以安装的Fix pack

    • 在用户路径下新建masterPasswordFile,这里在/root

      echo 'This text is the master password.' > /root/master_password_file.txt
    • 创建secureStorageFile

      $ /opt/IBM/InstallationManager/eclipse/tools/imutilsc saveCredential \
      -url http://www.ibm.com/software/repositorymanager/entitled/repository.xml \
      -userName YOUR_USER_NAME -userPassword YOUR_PASSWORD \
      -secureStorageFile /root/credential.store \
      -masterPasswordFile /root/master_password_file.txt

      其中YOUR_USER_NAMEYOUR_PASSWORD是你的IBM ID的用户名和密码

    • 如果需要安装指定版本的Fix pack,可以先检查可以安装的Fix pack

      $ /opt/IBM/InstallationManager/eclipse/tools/imcl listAvailablePackages \
      -repositories http://www.ibm.com/software/repositorymanager/com.ibm.websphere.ND.v85 \
      -secureStorageFile /root/credential.store \
      -masterPasswordFile /root/master_password_file.txt

      其中http://www.ibm.com/software/repositorymanager/com.ibm.websphere.ND.v85是 service repositories的URL,WAS ND 8.5的offering_IDcom.ibm.websphere.ND.v85,其它版本可以到这里查询。
      命令的执行结果会包含可用的Fix pack的版本:

      ...
      com.ibm.websphere.ND.v85_8.5.5000.20130514_1044
      com.ibm.websphere.ND.v85_8.5.5001.20131018_2242
      com.ibm.websphere.ND.v85_8.5.5002.20140408_1947
      com.ibm.websphere.ND.v85_8.5.5003.20140730_1249
      com.ibm.websphere.ND.v85_8.5.5004.20141119_1746
      com.ibm.websphere.ND.v85_8.5.5005.20150220_0158
      com.ibm.websphere.ND.v85_8.5.5006.20150529_0536
      com.ibm.websphere.ND.v85_8.5.5007.20150820_2101
      com.ibm.websphere.ND.v85_8.5.5008.20151112_0939
      com.ibm.websphere.ND.v85_8.5.5009.20160225_0435
      ...
  2. 安装

    • 安装com.ibm.websphere.ND.v85_8.5.5009.20160225_0435版本的Fix pack

      $ /opt/IBM/InstallationManager/eclipse/tools/imcl install \
      com.ibm.websphere.ND.v85_8.5.5009.20160225_0435 \
      -repositories http://www.ibm.com/software/repositorymanager/com.ibm.websphere.ND.v85 \
      -secureStorageFile /root/credential.store \
      -masterPasswordFile /root/master_password_file.txt \
      -installationDirectory /opt/IBM/WebSphere/AppServer \
      -acceptLicense -sP -showProgress
    • 如果在安装的时候不指定offering_version只指定offering_ID,会安装最新版本的Fix pack以及相应的interim fixes, 即上述命令中使用install com.ibm.websphere.ND.v85

方法二:手动下载Fix Pack安装
  1. 下载

    • 打开最新的Fix Pack下载地址WAS8.5 Fix Pack 列表选择Fix Pack下载,这里以Full Profile 8.5.5.8为例
    • 选择Fix pack文件
    • 选择Bulk Ftp下载
    • Ftp地址
    • 利用Wget下载:

      $ wget ftp://delivery04-mul.dhe.ibm.com/ecc/hsb/HSDM1MDM0NzQ3XzE0NjkwMTc5MTI1NTFfaVlTQ0d1emxORQ/8.5.5-WS-WAS-FP0000008-part1.zip
      $ wget ftp://delivery04-mul.dhe.ibm.com/ecc/hsb/HSDM1MDM0NzQ3XzE0NjkwMTc5MTI1NTFfaVlTQ0d1emxORQ/8.5.5-WS-WAS-FP0000008-part2.zip
    • 或者利用ftp

      $ ftp delivery04-mul.dhe.ibm.com
      ftp> binary
      ftp> prompt
      ftp> cd /ecc/hsb/HSDM1MDM0NzQ3XzE0NjkwMTc5MTI1NTFfaVlTQ0d1emxORQ
      ftp> mget *

  2. 解压

    • 将两个文件解压到同一路径,这里为/opt/Software/WASFP-8.5.5.8/
    • 通过IM的listAvailablePackages命令验证安装包的版本:

      $ /opt/IBM/InstallationManager/eclipse/tools/imcl listAvailablePackages \
      -repositories /opt/Software/WASFP-8.5.5.8/
      com.ibm.websphere.BASE.v85_8.5.5008.20151112_0939
      com.ibm.websphere.BASETRIAL.v85_8.5.5008.20151112_0939
      com.ibm.websphere.DEVELOPERS.v85_8.5.5008.20151112_0939
      com.ibm.websphere.DEVELOPERSILAN.v85_8.5.5008.20151112_0939
      com.ibm.websphere.EXPRESS.v85_8.5.5008.20151112_0939
      com.ibm.websphere.EXPRESSTRIAL.v85_8.5.5008.20151112_0939
      com.ibm.websphere.ND.v85_8.5.5008.20151112_0939
      com.ibm.websphere.NDDMZ.v85_8.5.5008.20151112_0939
      com.ibm.websphere.NDDMZTRIAL.v85_8.5.5008.20151112_0939
      com.ibm.websphere.NDTRIAL.v85_8.5.5008.20151112_0939

      我们将安装com.ibm.websphere.ND.v85_8.5.5008.20151112_0939(注意要与WAS一致,均为ND版本)

  3. 安装
    • 在安装前需要关掉所有的WAS server
    • 执行如下命令安装:
      $ /opt/IBM/InstallationManager/eclipse/tools/imcl install \
      com.ibm.websphere.ND.v85_8.5.5008.20151112_0939 \
      -repositories /opt/Software/WASFP-8.5.5.8/ \
      -installationDirectory /opt/IBM/WebSphere/AppServer/ -acceptLicense -sP
安装interim fix
  1. 方法一:利用IBM service repositories安装

    • 获取可以安装的interim fix

      /opt/IBM/InstallationManager/eclipse/tools/imcl listAvailableFixes \
      com.ibm.websphere.ND.v85_8.5.5009.20160225_0435 \
      -repositories http://www.ibm.com/software/repositorymanager/com.ibm.websphere.ND.v85 \
      -secureStorageFile /root/credential.store \
      -masterPasswordFile /root/master_password_file.txt

      其中com.ibm.websphere.ND.v85_8.5.5009.20160225_0435是其WAS的版本。命令的执行结果会包含可用的interim fix的id

      ...
      8.5.0.0-WS-WAS-IFPI56811_8.5.0.20160304_1619
      8.5.0.0-WS-WASJavaSDK-LinuxS39031-IFPI59137_8.5.0.20160317_1725
      8.5.0.0-WS-WASJavaSDK-LinuxS39031-IFPI61188_8.5.0.20160426_1251
      8.5.0.0-WS-WASJavaSDK-LinuxS39064-IFPI59137_8.5.0.20160317_1725
      8.5.0.0-WS-WASJavaSDK-LinuxS39064-IFPI61188_8.5.0.20160426_1251
      8.5.0.0-WS-WASJavaSDK-LinuxX32-IFPI59137_8.5.0.20160317_1725
      8.5.0.0-WS-WASJavaSDK-LinuxX32-IFPI61188_8.5.0.20160426_1251
      8.5.0.0-WS-WASJavaSDK-LinuxX64-IFPI61188_8.5.0.20160426_1251
      ...
    • 安装
      其安装命令与Fix pack有一些区别:

      imcl install <fix_ID>  \
      -repositories <repository_location> \
      -installationDirectory <install_dir> \
      -log <log_location>

      其中<fix_ID>为interim fix的id,上一步中已经获取到,当然也可以在安装包里的repository.xml文件中找到

      /opt/IBM/InstallationManager/eclipse/tools/imcl install \
      8.5.0.0-WS-WAS-IFPI56811_8.5.0.20160304_1619 \
      -repositories http://www.ibm.com/software/repositorymanager/com.ibm.websphere.ND.v85 \
      -installationDirectory /opt/IBM/WebSphere/AppServer -acceptLicense -sP -showProgress \
      -secureStorageFile /root/credential.store \
      -masterPasswordFile /root/master_password_file.txt
  2. 方法二:手动下载安装

    • 安装包的下载过程与Fix pack的类似,不再赘述。这里以WAS java sdk的补丁IFPI55778为例,下载并解压后从repository.xml中获取其fix_ID:8.5.0.0-WS-WASJavaSDK-LinuxX64-IFPI55778
    • 安装
      /opt/IBM/InstallationManager/eclipse/tools/imcl install \
      8.5.0.0-WS-WASJavaSDK-LinuxX64-IFPI55778 \
      -repositories /opt/Software/WAS8.5IF/IFPI55778/ \
      -installationDirectory /opt/IBM/WebSphere/AppServer \
      -acceptLicense -sP -log IFPI55778.log
参考资料
  1. 官方文档Installing fix packs on distributed operating systems using the command line
  2. 官方文档How to use imcl command to view the list of the packages, updates, and features in a source repository
  3. 官方文档Listing repository contents by using the imcl command
  4. 官方文档Command-line arguments for the imcl command
  5. 比较详细的Fix Pack安装过程Websphere Application Server Fixpack Installation using IMCL
  6. Installing and Configuring WebSphere 8.5 and 8.5.5
  7. How to download Fix Central fix pack images using FTP
  8. 安装interim fixInstalling an interim fix for IBM Business Process Manager (BPM) and WebSphere Process Server (WPS) by using IBM Installation Manager
  9. Installing or updating Installation Manager silently by using the installer
  10. Storing credentials