首先去http://www.ibm.com/developerworks/cn/downloads/im/udbexp/下载db2
cp到你的home下 然后解压tar -zxvf db2_v1012_linuxia32_expc_lite.tar.gz
解压后 进到cd /home/devinst/db2_v101fp2/linuxia32/s121127/expc_lite
进行安装./db2setup
然后出错啦
ERROR:
The 'strings' utility that is used to detect prerequisite libraries
is not present on this system. Please use your package or software
manager to install the GNU Binary Utilities.
DBI1324W Support of the db2_install command is deprecated. For
more information, see the DB2 Information Center.
Aborting the current installation ...
Run installation with the option "-f sysreq" parameter to force the installation
然后google然后查询GUN信息的查询到一个信息debain下安装gun
# apt-get update && apt-get upgrade
# apt-get install build-essential
# gcc -v
# make -v
尼玛我就知道google是大神 竟然不报错了
尼玛继续出错
Exception in thread "main" java.awt.HeadlessException:
No X11 DISPLAY variable was set, but this program performed an operation which requires it.
at java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:211)
at java.awt.Window.<init>(Window.java:545)
at java.awt.Frame.<init>(Frame.java:431)
at java.awt.Frame.<init>(Frame.java:396)
at LoadingGraphic.<init>(Unknown Source)
at LoadingGraphic.main(Unknown Source)
如果报错 The host name "lfyc-psi2-kvm3" is invalid. Specify a valid host name.
这个是主机名检查不对 vi /etc/hosts 修改主机名 再安装
启动DB2实例
su - liubl
. sqllib/db2profile
db2start
出错啦 什么东西不懂貌似缺失libaio这样一个包
切到root 安装吧apt-get install libaio1
然后
su - liubl
. sqllib/db2profile
db2start
终于看见啦SQL1063N DB2START processing was successful.
创建数据库db2 "create database tpch USING CODESET UTF-8 TERRITORY CN pagesize 32 K"
很久很久以后成功DB20000I The CREATE DATABASE command completed successfully.
连接到数据库db2 connect to tpch
导入点sample去看看首先进入 cd /opt/ibm/db2/V10.1/bin/
./db2sampl
配置自启动 切换到root用户下 cd /opt/ibm/db2/V10.1/bin/
./db2iauto -on liubl
切换到liubl用户 修改访问连接方式db2set DB2COMM=TCPIP
查看db2set
修改默认端口db2 update dbm cfg using SVCENAME 60000
重启db2stop force
db2start
连接看好使不clpplus liubl/db2@localhost/sample
报错No X11 DISPLAY variable was set, but this program performed an operation which requires it.
需要文本连接 clpplus -nw db2inst1/db2@localhost:60000/tpch
连接成功
连接远程服务器db2 catalog tcpip node p570 remote 192.168.1.220 server 50000
连接远程服务器 db2 catalog db sample at node p570
连接远程数据库 clpplus -nw db2admin/db2@192.168.1.220:50000/sample
成功连接
参考链接:http://www.cnblogs.com/yidianfeng/archive/2011/10/18/2216058.html
http://wenku.baidu.com/view/be7f2f15cc7931b765ce150f.html
小宝制造。