Linux安装DB2_V10

 

系统:centos5.5

已测试,安装db2_v1012_linuxx64_expc.tar.gz成功。

  1. 解压、安装
    [root@L160 opt]# tar -xf  db2_v1012_linuxx64_expc.tar.gz
    [root@L160 opt]# ls
    db2_v1012_linuxia32_expc.tar.gz  expc  lost+found  rh
    [root@L160 opt]# cd expc/
    [root@L160 expc]# ls
    db2  db2ckupgrade  db2_deinstall  db2_install  db2ls  db2prereqcheck  db2setup  doc
    [root@L160 expc]# ./db2_install 
    DBI1324W  Support of the db2_install command is deprecated. For
    ........................省略....................................
    Install into default directory (/opt/ibm/db2/V10.1) ? [yes/no] #询问你是否安装到这个位置上,输入yes
    yes
    DB2 installation is being initialized.
    .........................省略......................................
    The execution completed successfully.
    
    For more information see the DB2 installation log at
    "/tmp/db2_install.log.4516".
  2. 创建用户组和用户名
    [root@L160 expc]# groupadd -g 2000 db2iadm1
    [root@L160 expc]# groupadd -g 2001 db2fadm1
    [root@L160 expc]# useradd -m -g db2iadm1 -d /home/db2inst1 db2inst1
    [root@L160 expc]# useradd -m -g db2fadm1 -d /home/db2fenc1 db2fenc1
    [root@L160 expc]# passwd db2inst1  //输入俩次相同密码
    [root@L160 expc]# passwd db2fenc1   //输入俩次相同密码
  3. 安装License(产品许可证)
    [root@L160 expc]# cd /opt/ibm/db2/V10.1/adm/
    [root@L160 adm]# pwd  //查看当前目录
    /opt/ibm/db2/V10.1/adm
    [root@L160 adm]# chmod -R 775 *
    [root@L160 adm]# ./db2licm -a /home/software/expc/db2/license/db2expc_uw.lic  #不要直接复制这个命令,在解压的目录中可以找到license文件夹,请根据你的路径做相应的修改
    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/V10.1/license/en_US.iso88591"
  4. 创建实例和样本数据库
    [root@L160 adm]# cd /opt/ibm/db2/V10.1/instance
    [root@L160 instance]#  chmod -R 775 *
    [root@L160 instance]# ./db2icrt -p 50000 -u db2fenc1 db2inst1
    DBI1446I  The db2icrt command is running.
    ......................省略...............................
    DBI1070I  Program db2icrt completed successfully.
    
    [root@L160 instance]# su - db2inst1    //切换到db2inst1用户
    [db2inst1@L160 ~]$ 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@L160 ~]$ db2start
    SQL1063N  DB2START processing was successful.
    [db2inst1@L160 ~]$ db2 connect to sample
    
       Database Connection Information
    
     Database server        = DB2/LINUXX8664 10.1.2
     SQL authorization ID   = DB2INST1
     Local database alias   = SAMPLE
    
    [db2inst1@L160 ~]$ db2 "select * from staff"
    
    ID     NAME      DEPT   JOB   YEARS  SALARY    COMM
    ------ --------- ------ ----- ------ --------- ---------
        10 Sanders       20 Mgr        7  98357.50         -
    ........................省略...............................
       350 Gafney        84 Clerk      5  43030.50    188.00
    
      35 record(s) selected.
  5. 创建das管理服务器

    为了远程客户端能够用控制中心来控制数据库服务器,需要在数据库服务器上安装 das,当然,如果只是远程连接而不是远程管理,可以不用装,这里我安装了一下。
    [root@L160 instance]# groupadd -g 2002 db2asgrp
    [root@L160 instance]# useradd -m -g db2asgrp -d /home/db2as db2as
    [root@L160 instance]# passwd db2as   //输入2次相同密码
    Changing password for user db2as.
    New UNIX password:Retype new UNIX password:
    passwd: all authentication tokens updated successfully.
    [root@L160 instance]# su - db2as
    [db2as@L160 ~]$ su -
    Password:
    [root@L160 ~]# cd /opt/ibm/db2/V10.1/instance/
    [root@L160 instance]# ./dascrt -u db2as
    DBI1070I  Program dascrt completed successfully.
    
    [root@L160 instance]# su - db2as
    [db2as@L160 ~]$ db2admin start
    SQL4409W  The DB2 Administration Server is already active.
    [db2as@L160 ~]$  su - db2inst1  //确认db2inst1实例的服务名
    Password:
    [db2inst1@L160 ~]$ db2 get dbm cfg|grep SVCENAME
     TCP/IP Service name                          (SVCENAME) =
     SSL service name                         (SSL_SVCENAME) =
    [db2inst1@L160 ~]$ db2 update dbm cfg using SVCENAME 50000
    DB20000I  The UPDATE DATABASE MANAGER CONFIGURATION command completed
    successfully.
    [db2inst1@L160 ~]$ db2 get dbm cfg|grep SVCENAME
     TCP/IP Service name                          (SVCENAME) = 50000
     SSL service name                         (SSL_SVCENAME) =
    [db2inst1@L160 ~]$ db2licm -l  //看一下License的情况,svcename在客户端连接时需要用到
    Product name:                     "DB2 Express-C"
    License type:                     "Unwarranted"
    Expiry date:                      "Permanent"
    Product identifier:               "db2expc"
    Version information:              "10.1"
    Max number of CPUs:               "2"
    Max amount of memory (GB):        "4"
    Enforcement policy:               "Soft Stop"

参考文档:

http://www.db2china.net/home/space.php?uid=92501&do=blog&id=25771

posted @ 2013-05-22 11:17  爱自己  阅读(895)  评论(0编辑  收藏  举报