一、创建用户组和用户
(1)步骤1 以root用户登录需要安装DB2的服务器。
(2)步骤2 创建用户组和用户。
groupadd db2iadm1
groupadd db2fadm1
groupadd dasadm1
useradd -m -g db2iadm1 -d /home/db2inst1 -s /bin/bash db2inst1
useradd -m -g db2fadm1 -d /home/db2fenc1 -s /bin/bash db2fenc1
useradd -m -g dasadm1 -d /home/dasusr1 -s /bin/bash dasusr1
[root@module soft]# passwd db2inst1
db2inst1
[root@module soft]# passwd db2fenc1
db2fenc1
[root@module soft]# passwd dasusr1
dasusr1
二、 在db2下创建目录(任意)
[root@module soft]# pwd
/jiayan/soft
三、 拷贝并解压DB2_v10.5fp8_linuxx64_server_t.tar.gz程序包
[root@module soft]# ls
db2ese_c_105.lic
DB2_v10.5fp8_linuxx64_server_t.tar.gz
[root@module soft]# tar -xvf DB2_v10.5fp8_linuxx64_server_t.tar.gz
[root@module soft]# ls
server_t
db2ese_c_105.lic
DB2_v10.5fp8_linuxx64_server_t.tar.gz
查看解压结果:
[root@module soft]# cd server_t/
[root@module server_t]# ls
db2 db2ckupgrade db2ls ibm_im
db2checkCOL_readme.txt db2_deinstall db2prereqcheck installFixPack
db2checkCOL.tar.gz db2_install db2setup nlpack
四、执行DB2安装脚本
(1)步骤1 以root用户登录需要安装DB2的服务器。
(2)步骤2 进入目录/jiayan/soft/server_t。
[root@module server_t]# pwd
/jiayan/soft/server_t
[root@module server_t]# ./db2_install
DBI1324W Support of the db2_install command is deprecated.
Default directory for installation of products - /opt/ibm/db2/V10.5
***********************************************************
Install into default directory (/opt/ibm/db2/V10.5) ? [yes/no]
no
Enter the full path of the base installation directory:
------------------------------------------------
/jiayan/db2 ---选择安装路径
Specify one of the following keywords to install DB2 products.
SERVER
CONSV
EXP
CLIENT
RTCL
Enter "help" to redisplay product names.
Enter "quit" to exit.
***********************************************************
SERVER ---选择安装服务
***********************************************************
Do you want to install the DB2 pureScale Feature? [yes/no]
no ---不需要安装此服务
DB2 installation is being initialized.
Total number of tasks to be performed: 49
Total estimated time for all tasks to be performed: 1954 second(s)
Task #1 start
Description: Checking license agreement acceptance
Estimated time 1 second(s)
Task #1 end
。。。。。。。。
。。。。。。。。
Task #50 start
Description: Updating global profile registry
Estimated time 3 second(s)
Task #50 end
The execution completed successfully.
For more information see the DB2 installation log at
"/tmp/db2_install.log.7559".
五、安装以后在安装目录生成
[root@module db2]# ls
acs bnd dasfcn dsdriver guardium install lib32 map properties security32
adm cfg db2tss function ha instance lib64 misc rdf security64
adsm conv desktop gse include java license msg Readme tivready
bin das doc gskit infopop json logs pd samples tools
六、安装License
(1)步骤1 以root用户登录DB2服务器。
(2)步骤2 进入目录/jiayan/db2/adm(license所在目录)。
(3)步骤3 安装DB2 license,命令如下:(注意找到对应的lic的认证文件即可)
[root@module soft]# cp db2ese_c_105.lic /dsg/db2/license
[root@module adm]# ./db2licm -a /dsg/db2/license/db2ese_c_105.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: "/jiayan/db2/license/en_US.iso88591"
七、创建DAS(db2管理服务器)和数据库实例
(1)步骤1 以root用户登录DB2服务器
(2)步骤2 进入目录/jiayan/db2/instance
(3)步骤3 创建DAS。
[root@module instance]# ./dascrt -u dasusr1
DBI1070I Program dascrt completed successfully.
-u dasusr1表示指定DAS用户名。dasusr1为之前创建用户组和用户
(4)步骤4 创建数据库实例
[root@module instance]# ./db2icrt -a server -u db2fenc1 db2inst1 //也可以-p 60000指定对应的port,10.5版本默认是60000
DBI1446I The db2icrt command is running.
DB2 installation is being initialized.
Total number of tasks to be performed: 4
Total estimated time for all tasks to be performed: 309 second(s)
Task #1 start
Description: Setting default global profile registry variables
Estimated time 1 second(s)
Task #1 end
Task #2 start
Description: Initializing instance list
Estimated time 5 second(s)
Task #2 end
Task #3 start
Description: Configuring DB2 instances
Estimated time 300 second(s)
Task #3 end
Task #4 start
Description: Updating global profile registry
Estimated time 3 second(s)
Task #4 end
The execution completed successfully.
For more information see the DB2 installation log at "/tmp/db2icrt.log.15401".
DBI1070I Program db2icrt completed successfully.
注:在创建实例过程中如果出现“SQL6031N Error in the db2nodes.cfg file at line number "0". Reason code "11"”错误,说明uname -n中的机器名称与/etc/hosts文件中的机器名称不一致,修改一直即可。
(5)步骤5 设置数据库实例自动启动参数。
# su - db2inst1
$ db2iauto -on db2inst1
八、为实例配置TCP/IP通信服务,查看/etc/services文件
DB2_db2inst1 60000/tcp
DB2_db2inst1_1 60001/tcp
DB2_db2inst1_2 60002/tcp
DB2_db2inst1_3 60003/tcp
DB2_db2inst1_4 60004/tcp
DB2_db2inst1_END 60005/tcp
九、使用db2inst1 用户,为DB2服务管理配置SVCENAME赋值
db2 update dbm cfg using SVCENAME DB2_db2inst1
十、验证DB2数据库的安装
(1)以db2inst1用户ID登录系统:
# su - db2inst1
(2)启动数据库DB2:
[db2inst1@module ~]$ db2start
08/06/2018 11:45:19 0 0 SQL1063N DB2START processing was successful.
SQL1063N DB2START processing was successful.
(3)创建数据库实例
[db2inst1@module ~]$ db2 create database cyl using codeset GBK territory cn pagesize 8192
DB20000I The CREATE DATABASE command completed successfully.
(4)连接db2
[db2inst1@module ~]$ db2
(5)停掉db2
[db2inst1@module ~]$ db2stop
08/06/2018 11:50:20 0 0 SQL1064N DB2STOP processing was successful.
SQL1064N DB2STOP processing was successful.
rpm -qf /usr/lib64/libpam.so
http://ftp.gnu.org/pub/gnu/glibc/glibc-ports-2.16.0.tar.gz