1.1 preparations before installation
Create db2 management users, management groups, and instance users
# Groupadd db2user
# Groupadd db2adm
# Useradd-g db2adm-G db2user-m-d/home/db2 db2
Note: The-p parameter is followed by the password, which is currently blank. Change the password.
1.2 System Installation Method
1.2.1 CD installation method
1) In general, the linux system will automatically mount the disc at/media/cdrom. If you find that the disc is not mounted, You need to manually mount it as follows:
# Mount/dev/cdrom/media/cdrom
2) switch to the db2 installation directory (where the db2_install file is located)
# Cd/media/cdrom/
3) execute the installation script
#./Db2_install
1.2.2 image Installation Method
1) if the CD is an image file in iso format, follow these steps:
# Mount-o loop db2.iso/mnt // run the command in the directory where db2.iso is located/
2) switch to the db2 installation directory (where the db2_install file is located)
# Cd/mnt
3) execute the installation script
#./Db2_install
1.2.3 start Installation
1) After executing the installation script, enter the product version type
The installer will prompt you to enter a keyword. Here we enter the keyword DB2.ESE (Enterprise Server version). After you press enter, the system will start to install it, as shown below:
2) wait until installation is complete
3) Import db2ese. lic
# Cd/media/cdrom/db2/license
# Cp db2ese. lic/opt/IBM/db2/V8.1/adm
# Cd/opt/IBM/db2/V8.1/adm
#/Opt/IBM/db2/V8.1/adm/db2licm-a db2ese. lic
If the following error is prompted after the above operation is performed:
DBI1408N cannot open the file/opt/IBM/db2/V8.1/license/db2ese. lic
You can try the preceding command again.
1.2.4 FP18 upgrade
Check whether there are any running db2-related processes. If other db2 processes run, the upgrade may fail.
# Ps-aux | grep db2
If yes, Kill it.
Install the fixPack: FP18_MI00291.tar. decompress the package and run:
#./InstallFixPak-y
1.3 Configuration
1.3.1 create a DB2 database instance
# Cd/home/db2
#/Opt/IBM/db2/V8.1/instance/db2icrt-s ese-u db2 db2
Log on with a db2 user, edit the. bashrc file, and add or check the following configuration.
~> Vi. bashrc
Keep consistent with the following content:
If [-f/home/db2/sqllib/db2profile]; then
./Home/db2/sqllib/db2profile
Fi
Export LANG = en_US
Export EDITOR = vi
Set-o vi
1.3.2 create a shared library connection
Use root User
# Cd/home/db2
#/Opt/IBM/db2/v8.1/cfg/db2ln
1.3.3 set the environment variables for running db2 instances
# Su-db2
~> Db2set DB2COMM = tcpip (set to allow db2 to access through tcpip)
~> Db2set DB2CODEPAGE = 1386 (set the db2 Chinese page environment)
Check whether the/etc/services file contains the following information: (the last line)
DB2_db2 60000/tcp
DB2_db2_1 60001/tcp
DB2_db2_2 60002/tcp
Db2_db2 _end 60003/tcp
(Note: It is automatically added when the system is installed. If not, manually add it)
1.3.4 set the service port in the db2 instance
Start a db2 instance with a db2 User:
# Su-db2
~> Db2
Db2 => update database manager configuration using svcename 60000 (in/etc/services, open the corresponding port)
After setting, you can use the following method to verify whether the port is opened:
~> Telnet fig 60000
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
If the result is shown above, the access to port 60000 is enabled. Otherwise, restart the operating system and perform the following operations:
# Su-db2
~> Db2set DB2COMM = tcpip
~> Db2
Db2 => update database manager configuration using svcename 60000 (in/etc/services, open the corresponding port)
~> Db2start.
Then, use the telnet method for testing.