欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  网络运营

linux环境下非root用户DB2客户端安装教程

程序员文章站 2022-06-28 17:29:54
文章目录客户端下载安装步骤解压验证客户端下载下载对应版本得客户端,我这里用得是V11.5.5的,个人觉得实际上客户端是哪个版本都无所谓DB2客户端下载地址安装步骤解压将下载的包上传到linux服务器上,然后解压[gapsv4@68d38811132b ~]$ tar -zxvf v11.5.5_linuxx64_client.tar.gz然后进入同级目录client里面[gapsv4@68d38811132b ~]$ cd client/[gapsv4@68d38811132b cli...

客户端下载

下载对应版本得客户端,我这里用得是V11.5.5的,个人觉得实际上客户端是哪个版本都无所谓

DB2客户端下载地址

安装步骤

解压

将下载的包上传到linux服务器上,然后解压

[gapsv4@68d38811132b ~]$ tar -zxvf v11.5.5_linuxx64_client.tar.gz

然后进入同级目录client里面

[gapsv4@68d38811132b ~]$ cd client/
[gapsv4@68d38811132b client]$ ls
db2  db2_deinstall  db2_install  db2ls  db2prereqcheck  db2setup  installFixPack

接着我们执行db2_install文件

[gapsv4@68d38811132b client]$ ./db2_install

可能会出现下面的错误

sh: /usr/bin/file: No such file or directory
Requirement not matched for DB2 database "Server" . Version: "11.5.5.0".

Summary of prerequisites that are not met on the current system:

   DBT3514W  The db2prereqcheck utility failed to find the following 32-bit library file: "/lib/libpam.so*".


DBT3609E  The db2prereqcheck utility could not find the library file libnuma.so.1.


  Aborting the current installation ...
  Run installation with the option "-f sysreq" parameter to force the installation.

不要慌,我们只管看最后三行,然后按照提示在命令后面加上"-f sysreq"

[gapsv4@68d38811132b client]$ ./db2_install -f sysreq

然后如果出现(yes/no)就只管一路yes就可以了,因为是非root用户安装你,所以会默认在根目录创建sqllib,db2会安装在这个目录下

最后添加一下环境变量

[gapsv4@68d38811132b client] . $HOME/sqllib/db2profile

验证

我们连接个数据库验证一下

[gapsv4@68d38811132b ~]$ db2 connect to db2dic user db2dci using db2dci

SQL0332N  Character conversion from the source code page "1386" to the target code page "819" is not supported.

出现这个错误不要慌,这个是因为数据库的字符编码格式和当前用户的环境编码格式不一样,设置一下DB2CODEPAGE就可以了

db2set DB2CODEPAGE=1386  
db2 TERMINATE

然后再连接一下数据库

db2 connect to db2dic user db2dci using db2dci #此处伪用户密码,别妄想连上,用自己自己创建用户连
  Database Connection Information
​
 Database server        = DB2/LINUXX8664 11.5.0.0
 SQL authorization ID   = HUPP2DCI
 Local database alias   = HUPP2DCI

大功告成

本文地址:https://blog.csdn.net/LPJCSY/article/details/112608416