install-DB2-9.7-in-CentOS6
yum install -y libaio ksh rsh-server pam-devel nfs-utils compat-libstdc++-33 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++"
setenforce 0
sed -i 's/SELINUX=.*$/SELINUX=disabled/' /etc/selinux/config
修改核心參數
修改前
ipcs -l
[root@db2-9-7 ~]# ipcs -l
------ Shared Memory Limits --------
max number of segments = 4096
max seg size (kbytes) = 67108864
max total shared memory (kbytes) = 17179869184
min seg size (bytes) = 1
------ Semaphore Limits --------
max number of arrays = 128
max semaphores per array = 250
max semaphores system wide = 32000
max ops per semop call = 32
semaphore max value = 32767
------ Messages: Limits --------
max queues system wide = 15736
max size of message (bytes) = 65536
default max size of queue (bytes) = 65536
修改參數檔
- /etc/sysctl.conf
fs.file-max = 16384
kernel.randomize_va_space = 0
sysctl -p
修改後
[root@db2-9-7 ~]# ipcs -l
------ Shared Memory Limits --------
max number of segments = 4096
max seg size (kbytes) = 67108864
max total shared memory (kbytes) = 17179869184
min seg size (bytes) = 1
------ Semaphore Limits --------
max number of arrays = 128
max semaphores per array = 250
max semaphores system wide = 32000
max ops per semop call = 32
semaphore max value = 32767
------ Messages: Limits --------
max queues system wide = 15736
max size of message (bytes) = 65536
default max size of queue (bytes) = 65536
安裝
mkdir -p /db2/install
tar -zxf /tmp/v9.7fp7_linuxx64_server.tar.gz -C /db2/install
./db2prereqcheck
./db2_install -f NOTSAMP
AESE - 高級企業伺服器版(Advanced Enterprise Server Edition):這是高端版本,適用於較大和更複雜的數據庫環境。
ESE - 企業伺服器版(Enterprise Server Edition):適用於中大型環境,包含性能、可擴展性和可管理性功能。
CONSV - 連接伺服器(Connect Server):提供 DB2 客戶端的連接功能。
WSE - 工作組伺服器版(Workgroup Server Edition):適用於中小型企業,包含核心數據庫管理功能。
EXP - 快速入門版(Express-C):免費版,適合開發和小型應用程序。
PE - 個人版(Personal Edition):適合單一用戶的本地數據庫應用程序。
CLIENT - 客戶端:僅安裝 DB2 客戶端軟體,無服務器端功能。
RTCL - Runtime Client:運行時客戶端,適用於只需要 DB2 客戶端的執行環境。
[root@db2-9-7 ~]# cd /db2/install/server/
[root@db2-9-7 server]# sudo ./db2_install -f NOTSAMP
WARNING:
DBT3534W The db2prereqcheck utility determined that ASLR is set to ON and that this could cause issues with some tools.
WARNING:
The 32-bit library file libpam.so is not found on the system.
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
ESE
CONSV
WSE
EXP
PE
CLIENT
RTCL
Enter "help" to redisplay product names.
Enter "quit" to exit.
***********************************************************
ESE
WARNING:
DBT3534W The db2prereqcheck utility determined that ASLR is set to ON and that this could cause issues with some tools.
WARNING:
The 32-bit library file libpam.so is not found on the system.
DB2 installation is being initialized.
Total number of tasks to be performed: 47
Total estimated time for all tasks to be performed: 1954
Task #1 start
Description: Checking license agreement acceptance
Estimated time 1 second(s)
Task #1 end
Task #2 start
Description: Base Client Support for installation with root privileges
Estimated time 3 second(s)
Task #2 end
Task #3 start
Description: The DB2 required component.
Estimated time 11 second(s)
Task #3 end
Task #4 start
Description: Product Messages - English
Estimated time 13 second(s)
Task #4 end
Task #5 start
Description: Base client support
Estimated time 202 second(s)
Task #5 end
Task #6 start
Description: Java Runtime Support
Estimated time 121 second(s)
Task #6 end
Task #7 start
Description: Java Help (HTML) - English
Estimated time 7 second(s)
Task #7 end
Task #8 start
Description: Base server support for installation with root privileges
Estimated time 7 second(s)
Task #8 end
Task #9 start
Description: Global Secure ToolKit
Estimated time 51 second(s)
Task #9 end
Task #10 start
Description: Java support
Estimated time 12 second(s)
Task #10 end
Task #11 start
Description: SQL procedures
Estimated time 3 second(s)
Task #11 end
Task #12 start
Description: ICU Utilities
Estimated time 40 second(s)
Task #12 end
Task #13 start
Description: Java Common files
Estimated time 20 second(s)
Task #13 end
Task #14 start
Description: Base server support
Estimated time 259 second(s)
Task #14 end
Task #15 start
Description: IBM Software Development Kit (SDK) for Java(TM)
Estimated time 35 second(s)
Task #15 end
Task #16 start
Description: Control Center Help (HTML) - English
Estimated time 13 second(s)
Task #16 end
Task #17 start
Description: Connect support
Estimated time 3 second(s)
Task #17 end
Task #18 start
Description: Communication support - TCP/IP
Estimated time 3 second(s)
Task #18 end
Task #19 start
Description: Parallel Extension
Estimated time 3 second(s)
Task #19 end
Task #20 start
Description: EnterpriseDB code
Estimated time 3 second(s)
Task #20 end
Task #21 start
Description: Replication tools
Estimated time 21 second(s)
Task #21 end
Task #22 start
Description: Relational wrappers common
Estimated time 3 second(s)
Task #22 end
Task #23 start
Description: Control Center
Estimated time 41 second(s)
Task #23 end
Task #24 start
Description: Command Line Processor Plus
Estimated time 6 second(s)
Task #24 end
Task #25 start
Description: DB2 data source support
Estimated time 6 second(s)
Task #25 end
Task #26 start
Description: DB2 LDAP support
Estimated time 4 second(s)
Task #26 end
Task #27 start
Description: DB2 Instance Setup wizard
Estimated time 8 second(s)
Task #27 end
Task #28 start
Description: Integrated Flash Copy Support
Estimated time 53 second(s)
Task #28 end
Task #29 start
Description: Spatial Extender client
Estimated time 3 second(s)
Task #29 end
Task #30 start
Description: Base application development tools
Estimated time 34 second(s)
Task #30 end
Task #31 start
Description: DB2 Update Service
Estimated time 4 second(s)
Task #31 end
Task #32 start
Description: First Steps
Estimated time 3 second(s)
Task #32 end
Task #33 start
Description: Product Signature for DB2 Enterprise Server Edition
Estimated time 5 second(s)
Task #33 end
Task #34 start
Description: Sample database source
Estimated time 4 second(s)
Task #34 end
Task #35 start
Description: DB2 Text Search
Estimated time 70 second(s)
Task #35 end
Task #36 start
Description: Informix data source support
Estimated time 4 second(s)
Task #36 end
Task #37 start
Description: Setting DB2 library path
Estimated time 180 second(s)
Task #37 end
Task #38 start
Description: Executing control tasks
Estimated time 20 second(s)
Task #38 end
Task #39 start
Description: Updating global registry
Estimated time 20 second(s)
Task #39 end
Task #40 start
Description: Installing IBM Tivoli Monitoring for Databases
Estimated time 600 second(s)
Task #40 end
Task #41 start
Description: Starting DB2 Fault Monitor
Estimated time 10 second(s)
Task #41 end
Task #42 start
Description: Updating the db2ls link
Estimated time 1 second(s)
Task #42 end
Task #43 start
Description: Registering DB2 licenses
Estimated time 5 second(s)
Task #43 end
Task #44 start
Description: Setting default global profile registry variables
Estimated time 1 second(s)
Task #44 end
Task #45 start
Description: Initializing instance list
Estimated time 5 second(s)
Task #45 end
Task #46 start
Description: Registering DB2 Update Service
Estimated time 30 second(s)
Task #46 end
Task #47 start
Description: Updating global profile registry
Estimated time 3 second(s)
Task #47 end
The execution completed successfully.
For more information see the DB2 installation log at
"/tmp/db2_install.log.1870".
sudo groupadd db2iadm1
sudo groupadd db2fadm1
sudo useradd -m -g db2fadm1 db2fenc1
sudo useradd -m -g db2iadm1 -d /home/db2inst1 db2inst1
[root@db2-9-7 server]# sudo groupadd db2iadm1
[root@db2-9-7 server]# sudo groupadd db2fadm1
[root@db2-9-7 server]# sudo useradd -m -g db2fadm1 db2fenc1
[root@db2-9-7 server]# sudo useradd -m -g db2iadm1 -d /home/db2inst1 db2inst1
sudo /opt/ibm/db2/V9.7/instance/db2icrt -u db2fenc1 db2inst1
[root@db2-9-7 server]# sudo /opt/ibm/db2/V9.7/instance/db2icrt -u db2fenc1 db2inst1
DBI1070I Program db2icrt completed successfully.
su - db2inst1
export DB2DIR=/opt/ibm/db2/V9.7
export PATH=$DB2DIR/bin:$PATH
export LD_LIBRARY_PATH=$DB2DIR/lib:$LD_LIBRARY_PATH
[db2inst1@db2-9-7 ~]$ cat ~/.bashrc
# .bashrc
export DB2DIR=/opt/ibm/db2/V9.7
export PATH=$DB2DIR/bin:$PATH
export LD_LIBRARY_PATH=$DB2DIR/lib:$LD_LIBRARY_PATH
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
# User specific aliases and functions
# The following three lines have been added by UDB DB2.
if [ -f /home/db2inst1/sqllib/db2profile ]; then
. /home/db2inst1/sqllib/db2profile
fi
啟動資料庫
[root@db2-9-7 server]# su - db2inst1
[db2inst1@db2-9-7 ~]$ db2start
06/16/2024 23:44:22 0 0 SQL1063N DB2START processing was successful.
SQL1063N DB2START processing was successful.
[db2inst1@db2-9-7 ~]$