Install DB2 v9.7 on CentOS

    版本為 06:34, 27 Nov 2024

    到這個版本。

    返回到 版本存檔.

    查閱目前版本

    說明

    • CentOS 5/6 x86_64
    • IBM DB2 v9.7 Server
       

    可支援的 Linux 版本與 Hypervisors (需要虛擬化時)

    官網連結:http://www-969.ibm.com/software/repo...Platform=Linux

    DB2_v97_Linux_Supported.png

    更多系統需求可以閱讀附檔區的文件。

    安裝前步驟

    準備安裝檔:

    1. DB2_AESE_97_Linux_x86-64.tar.gz,DB2 主程式,必須由支援廠商提供。
    2. v9.7fp11_linuxx64_universal_fixpack.tar.gz,DB2 fixpack,可從官網下載。
       

    CentOS 安裝模式:Minimal Desktop

    需要的其它套件:
    NOTE: libstdc++ 需要 32bit 與 64bit 都安裝。

    CentOS 6.7)

    # yum install libstdc++.i686 pam-devel pam-devel.i686 ksh rsh-server
    
    # rpm -qa | grep "ksh\|openssh\|rsh-server\|nfs-utils\|libaio\|libstdc++\|libstdc++.i686\|pam-devel\|pam-devel.i686"
    libstdc++-4.4.7-16.el6.x86_64
    nfs-utils-lib-1.1.5-11.el6.x86_64
    openssh-clients-5.3p1-111.el6.x86_64
    pam-devel-1.1.1-20.el6.i686
    libaio-0.3.107-10.el6.x86_64
    ksh-20120801-28.el6.x86_64
    libstdc++-4.4.7-16.el6.i686
    openssh-server-5.3p1-111.el6.x86_64
    pam-devel-1.1.1-20.el6.x86_64
    nfs-utils-1.2.3-64.el6.x86_64
    openssh-5.3p1-111.el6.x86_64
    rsh-server-0.17-64.el6.x86_64
    

    CentOS 5.11)

    #> yum install pdksh nfs-utils rsh-server compat-libstdc++-296.i386 compat-libstdc++-33.i386 compat-libstdc++-33.x86_64 openssh
    

    CentOS 系統調校:

    關閉 SELinux
    #> setenforce 0
    #> sed -i 's/SELINUX=.*$/SELINUX=disabled/' /etc/selinux/config  
    
    停用 NetworkManager
    #> service NetworkManager stop
    #> chkconfig NetworkManager off
    

    調整系統核心參數

    #> ipcs -l
    
    ------ Shared Memory Limits --------
    max number of segments = 4096                                                     // SHMMNI
    max seg size (kbytes) = 67108864                                                    // SHMMAX
    max total shared memory (kbytes) = 17179869184             // SHMALL
    min seg size (bytes) = 1   
    
    ------ Semaphore Limits --------
    max number of arrays = 128                                                               // SEMMNI
    max semaphores per array = 250                                                     // SEMMSL
    max semaphores system wide = 32000                                        // SEMMNS
    max ops per semop call = 32                                                                // SEMOPM
    semaphore max value = 32767
    
    ------ Messages: Limits --------
    max queues system wide = 7916                                                      // MSGMNI
    max size of message (bytes) = 65536                                             // MSGMAX
    default max size of queue (bytes) = 65536                                  // MSGMNB
    

    編輯 /etc/sysctl.conf

    • shmmax: 實體記憶體數量 (byte),注意: 如果是 CentOS/RedHat 32-bit,而且使用預設的 Linux kernel 最多只能是 3GB (3221225472),若改用 hugemem kernel 可以增加到 4GB。參閱文章:https://access.redhat.com/documentat...MAX_Parameter_
    • shmall: 實體記憶體數量的 90% (Pages, 4KB/page),注意: 這項沒有 32-bit 限制,依照實際記憶體數量來設定。
      NOTE: 在 v9.7 這個值可以不用設定,因為不管設多少,一旦啟動 DB2 Instance 後,這個值會被系統修改成建議值,詳細可以檢視 db2diag.log。
    • msgmni, sem : 與範例相同
    • randomize_va_space: 更新到 FP5 以上時需要

    從最下方加上這幾行

    # for DB2
    # shmmax: 4GB
    kernel.shmmax = 4294967296
    fs.file-max = 16384
    kernel.randomize_va_space = 0 
    

    kernel.shmall, fs.file-max, kernel.msgmni, kernel.sem 這些值在 v9.7 不需要特別設,fs.file-max 如果設定成小於 16384,當 DB2 Instance 啟動後會被改成 16384,其餘也會被改成建議值。

    套用後再確認一次

    #> sysctl -p
    #> ipcs -l
    
    ------ Shared Memory Limits --------
    max number of segments = 4096
    max seg size (kbytes) = 4194304
    max total shared memory (kbytes) = 3670016
    min seg size (bytes) = 1
    
    ------ Semaphore Limits --------
    max number of arrays = 2048
    max semaphores per array = 250
    max semaphores system wide = 64000
    max ops per semop call = 32
    semaphore max value = 32767
    
    ------ Messages: Limits --------
    max queues system wide = 4096
    max size of message (bytes) = 65536
    default max size of queue (bytes) = 65536
    

    更多的指令用法

    查詢目前系統的參數值
    #> cat  /proc/sys/kernel/shmmax
    #> cat /proc/sys/kernel/shmall
    
    #> ipcs -lm
    ------ Shared Memory Limits --------
    max number of segments = 4096
    max seg size (kbytes) = 3145728                                                  SHMMAX
    max total shared memory (kbytes) = 2621440                   SHMALL
    min seg size (bytes) = 1
    

    安裝開始

    主程式安裝
    tar xzf DB2_AESE_97_Linux_x86-64.tar.gz
    cd aese/
    ./db2prereqcheck
    ./db2_install -f NOTSAMP
    

    -f NOTSAMP : 不要安裝 SAMP (System Automation for Multiplatforms),因為 CentOS 不支援這功能。

    Default directory for installation of products - /opt/ibm/db2/V9.7

    ***********************************************************
    Do you want to choose a different directory to install [yes/no] ?
    no

    Specify one of the following keywords to install DB2 products.

      AESE
      CLIENT
      RTCL

    Enter "help" to redisplay product names.

    Enter "quit" to exit.

    ***********************************************************
    AESE

    更新檔 fixpack 安裝

    檔案名稱: v9.7fp11_linuxx64_universal_fixpack.tar.gz

    tar xzf v9.7fp11_linuxx64_universal_fixpack.tar.gz
    cd universal/
    ./db2prereqcheck
    

    如果出現錯誤:
    DBT3534W  The db2prereqcheck utility determined that ASLR is set to ON and that this could cause issues with some tools.

    解決: 編輯 /etc/sysctl.conf, 加上這一行
    kernel.randomize_va_space = 0
    執行  echo 0 > /proc/sys/kernel/randomize_va_space

    WARNING:
       The 32-bit library file libpam.so is not found on the system.

    解決: 安裝這些套件
    yum install pam-devel pam-devel.i686

    ./installFixPack
    

    Enter full path name for the install directory -

    ------------------------------------------------
    /opt/ibm/db2/V9.7 <== 輸入 DB2 主程式安裝目錄

    新增 DB Instance

    #> groupadd db2adm
    #> useradd -g db2adm -c "DB2 Instance User" devinst
    
    #> cd /opt/ibm/db2/V9.7/instance/
    #> ./db2icrt -s ese -u devinst devinst 
    

    匯入 DB2 授權檔

    注意事項:

    • 匯入 license 必須使用 DB Instance 的帳號
    • 授權檔可從檔名區分不同類型
      • db2aese_c.lic - DB2 Advanced Enterpriese Server Edition(aese), CPU License type(_c)
      • db2ese_c.lic - DB2 Enterpriese Server Edition(ese), CPU License type(_c)
      • db2wse_c.lic - DB2 Workgroup Server Edition(wse),CPU License type(_c)
      • db2aese_t.lic - DB2 Advanced Enterpriese Server Edition(aese), Trial License type(_t)
    • 不同版本的授權檔不可互用
    • V9.1 與 V9.7 的授權不可互用

    TIP

    _c 以 CPU 計價
    _t 試用版
    _u 以 USER 數計價

     

    解開檔案

    su - db2inst
    unzip  DB2_AESE_CPU_QS_Activation_97.zip
    cd  aese_c/
    

    匯入前的授權資訊

    db2licm -l
    

    Product name:                     "DB2 Advanced Enterprise Server Edition"
    License type:                     "License not registered"
    Expiry date:                      "License not registered"
    Product identifier:               "db2aese"
    Version information:              "9.7"

    db2level

    DB21085I  This instance or install (instance name, where applicable: "mydev")
    uses "64" bits and DB2 code release "SQL0907B" with level identifier
    "080C0107".
    Informational tokens are "DB2 v9.7.0.11", "s150922", "IP23944", and Fix Pack
    "11".
    Product is installed at "/opt/ibm/db2/V9.7".
     

    開始匯入

    db2licm -a db2/license/db2aese_c.lic
    

    LIC1402I  License added successfully.

    LIC1426I  This product is now licensed for use as outlined in your License Agreement.  USE OF THE PRODUCT CONSTITUTES ACCEPTANCE OF THE TERMS OF THE IBM LICENSE AGREEMENT, LOCATED IN THE FOLLOWING DIRECTORY: "/opt/ibm/db2/V9.7/license/en_US.iso88591"

    匯入後的授權資訊

    db2licm -l
    

    Product name:                     "DB2 Advanced Enterprise Server Edition"
    License type:                     "CPU Option"
    Expiry date:                      "Permanent"
    Product identifier:               "db2aese"
    Version information:              "9.7"
    Enforcement policy:               "Soft Stop"

    TIPs:

    若要移除授權可以執行

    db2licm -r [Product identifier]

    DB2 Instance 啟動

    #> su - mydev
    $> db2 "update dbm cfg using svcename DB2_mydev"
    $> db2set DB2COMM=TCPIP
    $> db2set DB2CODEPAGE=950
    $> db2set DB2AUTOSTART=NO
    $> db2start
    $> ps -ef | grep db2sysc
    

    TIPs:

    如果要變更預設的 Port,可以修改 /etc/services。

    建議調整

    DB2 Instance:

    $> db2 "update dbm cfg using HEALTH_MON OFF"
    
    $> db2 "update dbm cfg using DIAGSIZE 50"
    
    // If enabled HADR
    db2 "update db cfg for <db-name> using BLOCKNONLOGGED yes" 
    

    F.A.Q

    Q: 執行 db2_install 最後出現錯誤 

    db2_install.log:

     DBI1130E  The IBM Tivoli System Automation for Multiplatforms (SA MP)
          could not be installed or updated because system prerequisites
          were not met. See the log file /tmp/prereqSAM.log.3380 for details.

    prereqSAM.log:

    prereqSAM:  OPTIONS         = '-l /tmp/prereqSAM.log.8304 --noliccheck --silent'
    prereqSAM:  OPT_SILENT      = 1
    prereqSAM:  OPT_NOLICCHECK  = 1
    prereqSAM: Detected operating system:  Linux
    prereqSAM: Detected architecture:  i386x
    prereqSAM: Detected distribution:  RH
    prereqSAM: Supported operating system versions:  RH Linux i386x - 4.6 5.0
    prereqSAM: Detected operating system version:
    Red Hat Enterprise Linux Server release 6.7 (Santiago)
    prereqSAM: Error: None of the supported operating system versions matched the version detected for the operating system:  RH Linux i386x
    prereqSAM: Supported operating system versions:  RH Linux i386x - 4.6 5.0
    prereqSAM: Detected operating system version:
    Red Hat Enterprise Linux Server release 6.7 (Santiago)
    prereqSAM: Error: Prerequisite checking for the ITSAMP installation failed:  Linux i386x RH
    Red Hat Enterprise Linux Server release 6.7 (Santiago)
    prereqSAM: Most severe error code returned:  22
    prereqSAM: The operating system has a version that is not supported.
     

    解決:試過了 CentOS 6.7 與 RedHat 6.7 都出現一樣的錯誤;但若是安裝在 SLES 11 卻沒有這類錯誤,應該是 SAMP 功能不支援 CentOS/RedHat。安裝主程式時可加上這參數:

    ./db2_install -f NOTSAMP
    Powered by MindTouch Core