db2 11.2 linux 安装,51CTO博客-专业IT技术博客创作平台-技术成就梦想

环境:centos7虚拟机

DB2版本:11.1

最近项目要用到DB2数据库,也没弄过DB2的,下载的dokcer的,有些访问受限制,所以只好自己手动搭一个了。

还好,网上有现成的关于11.1版本的DB2安装。

这篇安装的参考文章:http://www.qingpingshan.com/pc/fwq/235168.html

在官网下载的11.1的版本的。

v11.1_linuxx64_expc.tar.gz

我的软件存放位置在/home/setup下

一、解压:

[root@localhost setup]# tar -zxvf v11.1_linuxx64_expc.tar.gz -C /home/software

解压之后,是一个叫做expc的目录文件

[root@localhost expc]# ls

db2  db2ckupgrade  db2_deinstall  db2_install  db2ls  db2prereqcheck  db2setup

二,检验安装的先决条件

[root@localhost expc]# ./db2prereqcheck

一下子出来了好多的东西。我的翻页都被从头到尾了。这个时候最好开启个日志,来看究竟缺少的依赖关系。

缺依赖关系,有些东西还是yum也解决不了的。这我也没办法了。就只能这么空着了。

有些已经写明了,缺少什么什么就会缺少什么什么功能,这个大不了不要了吧。

最后,就安装了一个包文件。

所以说,实在安不上的,就不要纠结了,就直接安装得了。

三、然后直接安装了。

[root@localhost expc]# ./db2_install

刚开始的时候,需要输入两次yes,同意协议,同意安装路径。

之后就都自动了。

到#29启动的时候会停顿一下,害得我紧张了一下,还好它自己走完了。

创建用户组,至于为什么是这么个名称,可能是官方要求吧?

[root@localhost expc]# groupadd -g 2000 db2iadm1

[root@localhost expc]# groupadd -g 2001 db2fadm1

[root@localhost expc]# useradd -m -g db2iadm1 -d /home/db2inst1 db2inst1

[root@localhost expc]# useradd -m -g db2fadm1 -d /home/db2fenc1 db2fenc1

[root@localhost expc]# passwd db2inst1

这个密码设置的非常的麻烦。得拿本记下来才行。

四、这时候换到另一个目录下。这个目录是自动生成的。好像就是安装目录吧。。。

这个是给实例用户注册某个协议吧。。。

[root@localhost expc]# cd /opt/ibm/db2/V11.1/adm/

[root@localhost adm]# chmod -R 775 *

这里是自己的软件安装目录。

[root@localhost adm]# ./db2licm -a /home/software/expc/db2/license/db2expc_uw.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/V11.1/license/zh_CN.utf8"

五、继续跳目录

这里绑定了端口号。。。

[root@localhost adm]# cd /opt/ibm/db2/V11.1/instance/

[root@localhost instance]# chmod -R 775 *

[root@localhost instance]# ./db2icrt -p 50000 -u db2fenc1 db2inst1

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.5871".

DBI1070I  Program db2icrt completed successfully.

六、完成了。

要切换到实例用户,才可以登录db2数据库

[root@localhost instance]# su - db2inst1

上一次登录:五 12月  1 15:36:55 CST 2017pts/2 上

创建样本数据库

[db2inst1@localhost ~]$ db2sampl

Starting the DB2 instance...

Creating database "SAMPLE"...

Connecting to database "SAMPLE"...

Creating tables and data in schema "DB2INST1"...

Creating tables with XML columns and XML data in schema "DB2INST1"...

Stopping the DB2 instance...

'db2sampl' processing complete.

[db2inst1@localhost ~]$ db2start

SQL1063N  DB2START processing was successful.

[db2inst1@localhost ~]$ db2 connect to sample

Database Connection Information

Database server        = DB2/LINUXX8664 11.1.2.2

SQL authorization ID   = DB2INST1

Local database alias   = SAMPLE

[db2inst1@localhost ~]$ db2 "select * from staff"

竟然自带数据,666。

[db2inst1@localhost ~]$ db2licm -l

Product name:                     "DB2 Express-C"

License type:                     "Unwarranted"

Expiry date:                      "Permanent"

Product identifier:               "db2expc"

Version information:              "11.1"

Max number of CPUs:               "2"

Max amount of memory (GB):        "16"

Max number of cores:              "2"

Enforcement policy:               "Soft Stop"

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值