# Install: DB2 v9.7 on CentOS

##### 系統環境

- RedHat/CentOS 5/6 x86\_64
- IBM DB2 v9.7 Server

##### 安裝前步驟

準備安裝檔：

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 都安裝。*
> 
> *- 需要的 32bit 的套件都應該在原始安裝來源目錄內，如果找不到，可能少了 DVD2 的安裝來源。*
> 
> \- CentOS 7 的 32bit 套件包含在 CentOS-7.?-x86\_64-**Everything**-??? ISO 檔內。

CentOS 6, 7)

```
# yum install libaio ksh rsh-server pam-devel nfs-utils compat-libstdc++-33
# yum install libstdc++.i686 pam-devel.i686 compat-libstdc++-33.i686

# rpm -qa | grep "ksh\|openssh\|rsh-server\|nfs-utils\|libaio\|libstdc++\|libstdc++.i686\|pam-devel\|pam-devel.i686\|compat-libstdc++"
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
```

##### 安裝開始

主程式安裝

```editable
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 &gt; /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
> 
> \- WARNING:  
>  The 32 bit library file libstdc++.so.5 is not found on the system.
> 
> 解決：yum install compat-libstdc++-33.i686

```
./installFixPack
```

> Enter full path name for the install directory -  
> \------------------------------------------------  
> /opt/ibm/db2/V9.7 &lt;== 輸入 DB2 主程式安裝目錄

> 錯誤訊息:
> 
> ERROR: The installFixPack command is not able to detect if there are any DB2  
> libraries still loaded in memory in the current installation copy. Unload all  
> DB2 libraries and re-issue the installFixPack command with the '-f db2lib'  
> parameter. Note: All DB2 libraries must be unloaded before re-issuing the  
> installFixPack command with the '-f db2lib' parameter, otherwise, some  
> applications might not work properly and might need to be restarted to function  
> properly against the updated DB2 instance.

Solution: Reboot the host, alternatively, manually clean up the below processes and rerun the db2prechk command to verify that it returns 0.

For Linux)

```shell
lsof +D /opt/ibm/db2/V9.7
```

For AIX)

```
/usr/bin/genld -l | grep -p db2
```

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

[![DB2_v97_Linux_Supported.png](https://osslab.tw/uploads/images/gallery/2020-06/scaled-1680-/DB2_v97_Linux_Supported.png)](http://www.osslab.tw:8880/uploads/images/gallery/2020-06/DB2_v97_Linux_Supported.png)