Operating system: centos6.9_x64
DB2 installation files: db2_v101_linuxx64_expc.tar.gz
Installing the Database
tar zxvf db2_v101_linuxx64_expc. Tar . GZCD expc/. /db2_install
Select the default installation path: Yes
Configuration database
Create 3 groups of users
901902903 DB2DADM1
Create 3 Users
101 -D/home/db2inst1- m102 -D /home/db2fenc1-m 103 -D /home/db2dasusr1-m DB2DASUSR1
Add 3 user passwords
passwd Db2inst1 passwd db2fenc1 passwd DB2DASUSR1
Check whether user groups and users are created successfully
Cat grep DB2 cat /etc/passwdgrep DB2
Create an instance
Cd/opt/ibm/db2/v10. 1/instance. /DASCRT-u db2dasusr1. /db2icrt-a server-u db2fenc1 Db2inst1
Configuring DB2 self-booting
Cd/opt/ibm/db2/v10. 1/instance. /db2iauto-on Db2inst1
Configuring the DB2 Network Service port
su 50000
Modify DB2 connection mode to TCP/IP
Db2set Db2comm=tcpip
Working with databases
Start the database
su -db2inst1 Db2start
Create a database
DB2 Create DB TestDB using CodeSet utf-88192
Connect to the database:
DB2 Connect to TestDB
Show connections
DB2 List Applications
SQL Test Code:
create table tb1( id integer not null primary key,username varchar(200),password varchar(200));
insert into tb1(id,username,password) values(188,‘stevenjohn‘,‘stevenanthony‘) ;
select * from tb1;
drop table tb1;
Python Test code:
https://github.com/mike-zhang/pyExamples/blob/master/databaseRelate/db2Opt/db2Test1.py
All right, that's it, I hope it helps you.
This article GitHub address:
https://github.com/mike-zhang/mikeBlogEssays/blob/master/2017/20170706_cenos6.9 under Installation Db2.rst
Welcome to Supplement
Installing DB2 under CentOS 6.9