Linux安裝DB2_V10 系統:centos5.5 已測試,安裝db2_v1012_linuxx64_expc.tar.gz成功。 解壓、安裝 [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". 創建用戶組和用戶名 [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 //輸入倆次相同密碼 安裝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" 創建實例和樣本數據庫 [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. 創建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"