抓紧下载v10.5fp1_linuxx64_expc.tar.gz到~/Downloads/java_soft
cd java_soft
tar xf v10.5fp1_linuxx64_expc.tar.gz
可以看到在当前目录下产生了一个expc目录
cd expc
然后检查一下是否满足了安装条件:
./db2prereqcheck
提示
DBT3514W The db2prereqcheck utility failed to find the following 32-bit library file: "/lib/libpam.so*".按照这里的方案http://askubuntu.com/questions/428072/64-bit-db2-10-5-missing-32-bit-libpam-and-64-bit-libaio-on-ubuntu-12-04
sudo apt-get install libpam0g:i386 libaio1 ln -s /lib/i386-linux-gnu/libpam.so.0 /lib/libpam.so.0解决,接下来是正式安装:
su - root #创建das和instance cd /opt/ibm/db2/v10.5/instance ./dascrt -u db2das DBI1070I Program dascrt completed successfully. ./db2icrt -u db2inst1 db2inst1 DBI1070I Program db2icrt completed successfully. ./db2ilist db2inst1切换成das用户(因为给das分配的shell是sh而不是bash,我们进入了原始时代(不能tab补全了,当前路径pwd才能知道)
root@zerorun:/opt/ibm/db2/v10.5/instance# su - db2das $ pwd /home/db2das $ ls das/ adm conv dasprofile java metadata usercshrc bin ctrl dump lib msg userprofile cfg dascshrc function log tmp $ . das/dasprofile (注意这里的点命令,点号后面必须有空格,点相当于source命令) $ echo $PATH 。。home/db2das/das/bin:/home/db2das/das/adm $ which db2admin /home/db2das/das/bin/db2admin $ db2admin start SQL4409W The DB2 Administration Server is already active.切换成db2inst1用户
$ su - db2inst1 Password: db2inst1@zerorun:~$ pwd /home/db2inst1 db2inst1@zerorun:~$ ls examples.desktop sqllib db2inst1@zerorun:~$ . sqllib/db2profile db2inst1@zerorun:~$ echo $PATH 。。:/home/db2inst1/sqllib/bin:/home/db2inst1/sqllib/adm:/home/db2inst1/sqllib/misc:/home/db2inst1/sqllib/db2tss/bin db2inst1@zerorun:~$ which db2start /home/db2inst1/sqllib/adm/db2start db2inst1@zerorun:~$ db2start SQL1063N DB2START processing was successful.如果db2start报错 error while loading shared libraries: libnuma.so.1,解决"
db2inst1@zerorun:~$ db2 "create database tpch USING CODESET UTF-8 TERRITORY CN pagesize 32 k"
DB20000I The CREATE DATABASE command completed successfully.
这一步非常慢,硬盘灯狂闪,需要10分钟
Win7下的安装
抓紧下载C:\Users\IBM_ADMIN\DownloadDirector\v10.5fp1_winx64_expc.exe
双击自解压.
然后双击setup.exe
安装产品>安装新产品>下一步 >同意(此步有BUG!)
>选择自定义安装,不要选择典型安装(装出来命令行全是中文,很不方便) > 下一步
>下一步(把简体中文从右边移除!!!!!!!!!!)
>若干下一步
>取消设置通知!
>取消启用操作系统安全性
>完成
db2sampl.exe创建sample数据库,
或者db2sampl.exe -force(如果db已经存在)
C:\IBM\SQLLIB\BIN>db2sampl.exe -force Creating database "SAMPLE"... Existing "SAMPLE" database found... Dropping and recreating database "SAMPLE"... Connecting to database "SAMPLE"... Creating tables and data in schema "DB2ADMIN"... Creating tables with XML columns and XML data in schema "DB2ADMIN"... 'db2sampl' processing complete. C:\IBM\SQLLIB\BIN>
校验:
db2
connect to sample
select * from staff